Django, "the web framework for perfectionists with deadlines", is a Python-based framework for creating web applications. With a powerful object-based database mapper, a clean syntax for mapping URLs to views, a simple template language and a convenient automatically generated administration interface, Django is the most popular of the Python web frameworks.
Questions tagged [django]
1012 questions
2
votes
1 answer
Static files are not found when running django + gunicorn + nginx on docker
I know it's well answered question but non of ones I've found seems to work for me.
I have simple django project and I'm trying to run it on Docker with gunicorn and nginx. Below is my configuration
Dockerfile
# Pull base image
FROM…

kebie
- 141
- 1
- 1
- 7
2
votes
1 answer
hide port in ngnix and display site-link instead
I have already tried suggestions mentioned in:
Hide port in Nginx reverse proxy redirection
but it does not help me.
I have done nginx reverse proxy for my django+gunicorn application and it is open on port 8000. I can access a machine name as…

Peeyush Pashine
- 21
- 3
2
votes
0 answers
Django (uwsgi) + nginx hangs on curl requests
I am trying to debug a problem where a request done with curl hangs. The website renders fine if I open it through any web browser. I can't find anything suspicious into the log files as well.
I've enabled logging error_log info; but I don't see…

Dimitar Petrov
- 121
- 2
2
votes
4 answers
nginx (13: Permission denied) on socket
I'm trying to set up a Django app using uwsgi and nginx, but I keep butting my head against a very irritating problem.
I've used the uwsgi docs as a reference guide.
When serving the app through uwsgi (uwsgi --http :8000 --module myproject.wsgi)…

DoTheGenes
- 21
- 1
- 1
- 6
2
votes
1 answer
Redirecting from www to no www in nginx reverse proxy
I'm developing a Django app with nginx reverse proxy and gunicorn application server. Being a newbie web developer, I need help with redirecting www traffic to no www at the webserver level. I'm currently doing the same at the middleware level…

Hassan Baig
- 2,325
- 12
- 29
- 48
2
votes
1 answer
HTTP 503 errors with Apache and mod_wsgi
I have written a webapp in Django that I host under Apache 2.4 using mod_wsgi.
At first glance, it works fine. However, when the Apache process has been running for a while, the webapp starts responding with 503 errors. You can get through sometimes…

Compizfox
- 384
- 1
- 6
- 18
2
votes
1 answer
Nginx - connect() failed (111: Connection refused) while connecting to upstream
I am running a site that uses Django, Nginx, Gunicorn, Supervisord and fail2ban (which only allows ssh, http and https). The site is live and working correctly but there are some nginx error log entries that are concerning:
connect() failed (111:…

darkpool
- 169
- 1
- 1
- 6
2
votes
1 answer
Reuse django error page in nginx
I want to avoide inconsistent error pages using django and nginx. If a static file is not found the default nginx error page and not the django one. I think it would result in bad performance to redirect each failed request to the gunicorn server to…
user400086
2
votes
1 answer
Serving files with nginx and django
I'm trying to serve protected files with nginx using X-Accel-Redirect header by following this tutorial (and many others).
physical path: /home/media/file.pdf
url: example.com/media/file.pdf
nginx configuration:
location /media/ {
internal;
…

vitush93
- 21
- 1
- 2
2
votes
1 answer
Troubleshooting nginx caching for static assets
I have a Django website where users post images for the whole community to see (kind of like 9gag).
I use Azure storage to save and serve the images. The webserver is an nginx reverse proxy + gunicorn cocktail. Gzip is up and running on my website…

Hassan Baig
- 2,325
- 12
- 29
- 48
2
votes
1 answer
Nginx rewrite certain port to subpath (nginx + uwsgi + django)
My goal is to rewrite everything under http://localhost:8000 to http://localhost/foo
I followed every step mentioned in this link, but still couldn't get it work.
Here's my settings:
urls.py (Django)
urlpatterns = [
url(r'^$', 'home.view'),
…

amigcamel
- 121
- 1
- 6
2
votes
1 answer
Strange 404 URL requests on my site
I recently launched a Django powered site and I have 404 error reporting on. I've been getting some strange URL requests, one every couple of days.
/renewPwd.php/
/index.php/
/mobile/
/m/
/admininstrator/
I find some of them very strange since I…

Kritz
- 135
- 4
2
votes
1 answer
django uwsgi and nginx = 400 bad request
I moved my Django website and pip3 install Django.
I use the same uswgi wrapper than on the install of server #1 and it works.
On server #2, I get a 400 Bad request.
If I stop the uwsgi server, I get a 502 bad gateway from NGINX and when UWSGI is…

thms0
- 71
- 9
2
votes
3 answers
Nginx 1.2.1 custom 404
I'm trying to make a custom 404 error with nginx.
First in my local machine I added the following lines to the default site:
error_page 404 /custom_404.html;
location = /custom_404.html {
root /usr/share/nginx/html;
…

Madox
- 143
- 4
2
votes
0 answers
How can I configure a Django website to work with Apache 2.4 VirtualHosts?
I recently started developing Django websites and I want to deploy them on a CentOS VPS with mod_wsgi and Apache.
I followed this guide and it works perfectly, but I would like to have more than one Django website running at the same time, so I…

user256472
- 21
- 3