diff --git a/docs/contributing.md b/docs/contributing.md index e39a7247..47968a91 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -2,9 +2,58 @@ Thank you for your interest! -## Running tests -* `python -m pip install pytest` -* `python -m pytest tests` +## Setting up the dev environment + +It is ideal to create a virtual environment whenever you want to work on +a python project. **Note:** This is not a necessity to work on sanic. + +Create a a new virtual environment if you dont have one, using: + +`python3 -m venv ` + +Enable it using: + +`. /bin/activate` + +Get the source of sanic: + +`git clone https://github.com/channelcat/sanic` + +`cd sanic` + +Install sanic : + +`python setup.py install` + +Install the dev dependencies: + +`pip install -r requirements-dev.txt` + +Create a new branch for your bugfix or feature: + +`git checkout -b ` + +Now you can start working on sanic. + +## Tests + +Install pytest and flake8: + +`pip install pytest` + +`pip install flake8` + +Run the tests: + + `pytest tests` + + Ensure your code is properly linted using flake8: + + `flake8 sanic/` + + ## Pull request + + Once all tests have passed send out a PR. ## Warning -One of the main goals of Sanic is speed. Code that lowers the performance of Sanic without significant gains in usability, security, or features may not be merged. \ No newline at end of file +One of the main goals of Sanic is speed. Code that lowers the performance of Sanic without significant gains in usability, security, or features may not be merged. diff --git a/docs/getting_started.md b/docs/getting_started.md index c7a437d3..9032fddb 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -1,25 +1,33 @@ # Getting Started -Make sure you have pip and python 3.5 before starting +Make sure you have pip and python 3.5 before continuing. -## Benchmarks - * Install Sanic - * `python3 -m pip install sanic` - * Edit main.py to include: +## Installation + + Install `sanic` by using the following command: + + `python3 -m pip install sanic` + +It is as easy as that! + +## Hello World! + + Create a file called `main.py` and paste the following code into. ```python from sanic import Sanic -from sanic.response import json +from sanic.response import text app = Sanic(__name__) @app.route("/") async def test(request): - return json({ "hello": "world" }) + return text("Hello World!") app.run(host="0.0.0.0", port=8000, debug=True) ``` - * Run `python3 main.py` + Run it by using `python3 main.py` -You now have a working Sanic server! To continue on, check out: +You now have a working Sanic server! To learn more about Sanic, read the following: * [Request Data](request_data.md) - * [Routing](routing.md) \ No newline at end of file + * [Routing](routing.md) + * [Serving static files](static_files.md)