By using gunicorn without nginx from digitalcloud tutorial
my server is runing and on the console is
not found: /static/style.css
settings.py
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
I already tried to
-
collectstatic
-
do
urlpatterns += staticfiles_urlpatterns()
in urls.py file -
makemigrations + migrate
3
Answers
maybe django try read ‘static//static/style.css’ but you need this: ‘style.css’ 😉 ?
MEDIA_URL = ‘/media/’
MEDIA_ROOT = os.path.join(BASE_DIR, ‘media’)
STATIC_URL = ‘/static/’
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
urlpatterns = [your urls here] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
You can create in your project folder settings then in them create settings files like names:
local.py
this run in VM like: python manage.py runserver –settings settings.local
remember in urls add:
web.py
and then in gunicorn import only web.py file project to read in nginx
this run in VPS server.