improvements to a few docs
This commit is contained in:
parent
47b417db28
commit
13e27e53f0
|
@ -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 <any name>`
|
||||
|
||||
Enable it using:
|
||||
|
||||
`. <any name>/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 <branch name>`
|
||||
|
||||
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.
|
|
@ -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)
|
||||
* [Serving static files](static_files.md)
|
||||
|
|
Loading…
Reference in New Issue
Block a user