pip install gunicorn
pip install whitenoise
pip install dj-database-url
pip install psycopg2
- run cli venv
python manage.py collectstatic
- settings.py
import os
STATIC_URL = 'static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
pip freeze > requirements.txt
MIDDLEWARE = [
# ...
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
# ...
]
- added staticfiles
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
web: python manage.py migrate && python manage.py collectstatic && gunicorn movies.wsgi
- just write the python version
3.11.0
using PostgreSQL railway.app
- settings.py
- import dj_database_url
DATABASES = {
'default': dj_database_url.config(default="sqlite://db.sqlite3")
}
- step install railway cli for windows
- 5.1 - enable scoopy reading install railway cli run for windows in powershell or cmd
- 5.2 -> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- 5.3 -> irm get.scoop.sh | iex
- 5.4 -> scoop install railway
- 6.1 -> railway login
- 6.1 -> railway link
- 6.1 -> railway service
- you need to add the variables manually before executing the command
- 6.1 -> railway variables
to use the api check the documentation in swagger click link in production