ASGI RESTful API by iyazerski/cookiecutter-api
Make sure that all requirements related for your platform will be installed before main package installation.
Normally, to build project image you will need to install following packages:
Following instructions are guidelines, you can install it differently, however,
executing the following commands will ensure that portfolio
is installed correctly:
Clone repository and create virtual environment:
foo@bar:~$ cd portfolio
foo@bar:~/portfolio$ python -m venv venv && source venv/bin/activate
foo@bar:~/portfolio$ python -m pip install --upgrade pip wheel setuptools
Install requirements:
foo@bar:~/portfolio$ pip install -r requirements/dev.txt
Make sure that you have execution permissions for docker
, docker-compose
, python
and pydeployhelp
.
Use pydeployhelp
package to build project image:
foo@bar:~/portfolio$ pydeployhelp
Enter deploy tasks from following: all | build up down: build
✓ processing deploy tasks: build
Enter deploy targets from following: all | portfolio-backend-dev: all
✓ processing deploy targets: portfolio-backend-dev
Do you agree to start processing (y/N)?: y
Create .env
file in project root with environment variables:
ENV=dev
PROJECT_SLUG=portfolio
HOST=localhost
PORT=8080
ENABLE_CORS=True
VOLUMES_ROOT=$HOME/projects/portfolio
What does each variable mean:
-
ENV
: environment type (dev, prod), could contain any value, but for production please setENV=prod
-
PROJECT_SLUG
: this name will be used for docker containers creation -
HOST
: backend host (e.g. localhost, project.dns.com) -
PORT
: backend port, will be ignored whenENV=prod
-
ENABLE_CORS
: if True, all origins and methods will be allowed -
VOLUMES_ROOT
: path to directory, where docker volumes will be stored; it's highly recommended to set this value to the path of the project root (on development machine) - this will allow you to use the same data when debugging from IDE and when deploying via docker (pydeployhelp)
You can manually start project:
foo@bar:~/portfolio$ python run.py
Use pydeployhelp
package to run project image:
foo@bar:~/portfolio$ pydeployhelp
Enter deploy tasks from following: all | build up down: up
✓ processing deploy tasks: up
Enter deploy targets from following: all | portfolio-backend-dev: all
✓ processing deploy targets: portfolio-backend-dev
Do you agree to start processing (y/N)?: y
portfolio is equipped with automatic documentation (via sphinx
), which can be generated
from docs
directory as follows:
foo@bar:~/portfolio$ cd docs
foo@bar:~/portfolio/docs$ make html
After executing this command you will find autogenerated documentation entrypoint at docs/build/index.html