All start samples for Python frameworks with Docker-compose deployment
Framework | Address |
---|---|
FastAPI | 127.0.0.1:3000 |
Django | 127.0.0.1:3001 |
Flask | 127.0.0.1:3002 |
Aiohttp | 127.0.0.1:3003 |
Tornado | 127.0.0.1:3004 |
Pyramid | 127.0.0.1:3005 |
CherryPy | 127.0.0.1:3006 |
docker-compose up --build
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- Create and describe
main.py
file
python main.py
- Using
uvicorn main:app --reload
with defaultPORT=8000
- Using
uvicorn main:app --host 0.0.0.0 --port 3001
with project config
pip install -r requirements.txt
django-admin startproject django_framework
cd django_framework && python manage.py startapp django_app
- Add new app in
django_framework/settings.py
INSTALLED_APPS const - Create view in
django_app/views.py
mkdir django_app/templates/
touch django_app/templates/root.html
and describe html- Set app url in
django_framework/urls.py
touch django_app/urls.py
and set url- Set
DEBUG = False
andALLOWED_HOSTS
indjango_framework/settings.py
- Hide
SECRET_KEY
fromdjango_framework/settings.py
python manage.py runserver
pip install -r requirements.txt
- Create and describe
main.py
file - Create
wsgi.py
file withgunicorn
start config (production start config)
python main.py
- Using default start Flask command:
flask run
- Using
gunicorn --bind 0.0.0.0:$PORT wsgi:app
pip install -r requirements.txt
- Create and describe
app/routes.py
file - Create and describe
main.py
file
python main.py
pip install -r requirements.txt
- Create and describe
views/views.py
file - Create and describe
main.py
file
python main.py
pip install -r requirements.txt
- Create and describe
main.py
file
python main.py
pip install -r requirements.txt
- Create and describe
main.py
file
python main.py