2š
The dev server is single-threaded so if something keeps waiting, it blocks every request.
I usualy work with the django concurent dev server which is multi-threaded and works much better. Also it is very fast and easy to setup š
-1š
it might depends on your setup.
what did you do for the static? whatās the settings? did you do the collect static?
try this in case
however, about serving static files in development:
Warning This will only work if DEBUG is True.
Thatās because this view is grossly inefficient and probably insecure.
This is only intended for local development, and should never be used
in production.
from here
canāt you just supply the static files in another server?
-1š
After reading all answers if still anyone having this problem then ā¦
As per Django nature you donāt need to do anything to serve static files
just your settings file should have proper configuration as follows:
STATIC_URL = '/static/'
STATICFILES_DIRS = (
# **THIS IS USED WHEN YOUR STATIC FILES ARE IN SOME OTHER FOLDER ALSO**
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
FOLDER_NAME,
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
INSTALLED_APPS = (
# other apps
'django.contrib.staticfiles',
)
But if still you face problem put this into your urls.py
:
(rā^(path of your file)$ā, ādjango.views.static.serveā , {ādocument_rootā: āPROJECT_ROOT_DIRā + āpath to the static folderā}),
Above URL will serve for static files whether they are JS files or CSS or images.
In case of production server you donāt need this.
Then run: python manage.py collecstatic
.
Hope this helps.
- Can't install python mysql library on Mac Mavericks
- Can't open file 'django-admin.py': [Errno 2] No such file or directory
- Django: Getting data from different database
- Log all errors to console or file on Django site