4👍
For django v 1.5+ , in your settings.py file, Make the configuration
ALLOWED_HOSTS = [‘*’] if you want a quick fix
If you are really going production (and concerned about security), put allowed host names in ALLOWED_HOSTS
this SO link has more info
7👍
Use the following LOGGING
settings, then you should be able to see the error in the console.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'console':{
'level': 'DEBUG',
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
remember to set DEBUG = False
- How to check Django security vulnerabilities and how to fix them
- What are some alternative for ModelChoiceField for large number of choices?
- LDAP authentication with django REST
- Django class based views – UpdateView with two model forms – one submit
- Django TransactionManagementError when using signals
1👍
I got the 500 Internal Server
error after switching DEBUG
off as well. Another reason this could happen is if you have an extra /
at the start of the relative static path. So replace:
<link rel="stylesheet" href="{% static '/css/somecustom.css' %}">
with
<link rel="stylesheet" href="{% static 'css/somecustom.css' %}">
i.e. search and replace {% static '/
with {% static '
in your template files.
To understand this further you can read up on the caching behaviour of Django’s ManifestStaticFilesStorage
backend.
- Limit Maximum Choices of ManyToManyField
- How to access directory file outside django project?
- Which function in django creates a HttpRequest instance and hands to a view?
- Jquery ajax form success callback not being called
0👍
Go to django admin portal.
Click on sites table and edit the example.com site to your domain name.
It will work.
- Could not parse the remainder for boolean operators in django template
- Dynamic pagination using Generic ListView
- How can I make a Django update with a conditional case?
- How to find top-X highest values in column using Django Queryset without cutting off ties at the bottom?
- Django: time zone issue