I'm trying to run my django site in deployment mode with DEBUG=False
. In fact when i do a python manage.py collectstatic
it will collect all static files into my folder /mysite/static
. But when i load my homepage my static files wont load Not Found
occurs.
My Django version is 1.10.4 Here is my STATIC ROOT definition and urls folder:
In settings.py:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static") (i tried also just only 'static')
MEDIA_ROOT = BASE_DIR + '/mysite/media'
MEDIA_URL = '/media/'
my urls.py:
urlpatterns = [
url(r'', include('mysite.urls')),
]
urlpatterns += staticfiles_urlpatterns()
I notice that is not assuming my collectstatic folder instead is considering the static file in app folder.
doing python manage.py findstatic mysite/js/javascript.js
Found 'app/js/javascript.js' here:
/home/user/mysite/app/static/app/js/javascript.js
Well, once that DEBUG=False
it should give something like:
/home/user/mysite/static/app/js/javascript.js
At production server, your nginx or apache should serve the static files. When Debug = False, django stops serving the static files. Please share your nginx settings, I can help you out there...
For more info, check this link