Open elebumm opened 7 years ago
This has something to do with the DebugToolbarMiddleware I believe
So I disabled DEBUG mode and changed ALLOWED_HOSTS now the website loads but I get no css?
Did you run manage.py collectstatic (seems you never did setup Django for production)
I never ran that but after running it I got this error:
raise ImproperlyConfigured("You're using the staticfiles app " django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path
Deploying an Django app in production involves more then adding an item to ALLOWED_HOSTS and turning off debug. https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
Not only should you setup and folder that will contain the selected static files, you probably also have to configure part of your webserver for it. Same goes for MEDIA_FILES.
elebumm,
You need to add and modify the following info:
development.py file: Django Debug Toolbar (you need to modify to add the name of the app) INSTALLED_APPS += ( 'debug_toolbar',)
Django Debug Toolbar Middleware (and you need to add the middleware classes. MIDDLEWARE_CLASSES += ( 'debug_toolbar.middleware.DebugToolbarMiddleware', )
finally in the urls.py file add the following:
if settings.DEBUG:
import debug_toolbar
urlpatterns += (
url(r'^__debug__/', include(debug_toolbar.urls)),
)
more info of this at http://django-debug-toolbar.readthedocs.io/en/stable/installation.html
I hope you found this helpful.
I followed the documentation and also get the same error. More or less new to Django, so this is frustrating.
There seems to be some kind of compatibility problem. I have tried this on 1.8-1.10 and they all break with different errors (missing or undefined includes).
DEBUG_TOOLBAR_PATCH_SETTINGS = False
from django.conf import settings
from django.conf.urls import include, patterns, url
if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns('',
url(r'^__debug__/', include(debug_toolbar.urls)),
)
(Add below line in your settings.py(in this case base.py) inside MIDDLEWARE_CLASSES you have to add )
'debug_toolbar.middleware.DebugToolbarMiddleware',
python manage.py runserver
more info of this at http://django-debug-toolbar.readthedocs.io/en/stable/installation.html
Hi all,
Sorry for these issues due to significant upstream changes in Django Toolbar. I was trying to figure out the most appropriate migration path. I also did not want to change any non-development code as Django toolbar should be limited to development only.
I have made my latest commit 3a17284f63b07ce91a0313ff69c3b966738c70d1 to the master to fix these issues. I recommend upgrading all pip packages and then rerunning the installation. Or you can learn the changes from the commit and apply them to your existing projects.
Would like to thank @elebumm, @acidjunk , @medincar , @artforlife and @emilgeorgejames1 for your helpful inputs. You are really the ones taking this project to the edge! 😄
Please comment here if you face any problems now. I shall close this issue in a few days.
Thanks! Arun
I faced the same issue today. I use ngrok to tunnel the local to internet . I get this error #67. No problem when I use in localhost. # I then added '.ngrok.com' to ALLOWED_HOSTS and everything works fine now.
Hi, It is working fine in Production but not able to see CSS, even not after runnint 'python manage.py collectstatic'
It worked fine now. This tutorial helped me to make application live on Production. https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 may be I can write more details in the docs about deploying on Production
Hello guys!
I am having exactly this same problem trying to make it work Django on a raspberry PI with Raspian. I have checked that all the file modifications listed here are applied but still happens...
Any help??
Just make sure the following code inside the urls project file not the App url file
if settings.DEBUG: import debug_toolbar urlpatterns += [ url(r'^debug/', include(debug_toolbar.urls)), ]
I had the same error. The toolbar worked but when running tests it threw
django.urls.exceptions.NoReverseMatch: 'djdt' is not a registered namespace
I am using a Custom User model subclassing Abstractuser and i splitted urls.py into one urls.py in every app directory.
Since I moved the Debug Toolbar url patterns from the main urls.py into the users.urls.py the error is gone.
Tried and still have the same issue. If I turn off the debug to Fasle manually, then the error is gone, if I just run manage.py test with all those settings in the official doc, then I get the same error.
django.urls.exceptions.NoReverseMatch: 'djdt' is not a registered namespace
Just make sure the following code inside the urls project file not the App url file
if settings.DEBUG: import debug_toolbar urlpatterns += [ url(r'^debug/', include(debug_toolbar.urls)), ]
i fix my problem with make sure
`if settings.DEBUG: import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns`
in project file not in app urlfile, THX
I followed all the instructions to get this deployed and when I run the server and connect using Google Chrome I get this error here. I am unsure as to how to fix this.
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.