Questions tagged [django]

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.

Filter by
Sorted by
Tagged with
290 votes
4 answers
118k views

Why do I need Nginx and something like Gunicorn?

I'm looking for an overly simplified answer to the following question. I'm trying to build a foundational understanding of how Nginx works alongside something like Gunicorn. Do I need both Nginx and ...
a.m.'s user avatar
  • 3,005
88 votes
2 answers
35k views

Why do I need nginx when I have uWSGI

There are many tutorials on how to configure nginx to cooperate with uWGSI when I want to deploy Django application. But why do I need nginx in this kit? uWSGI itself can serve WSGI Python ...
user983447's user avatar
  • 1,127
75 votes
9 answers
291k views

Why do I get sqlite error, "unable to open database file"?

Using my Django app, I'm able to read from the database just fine. When the application didn't have permission to access the file, it gave me this error: attempt to write a readonly database Which ...
Nick Bolton's user avatar
  • 5,136
48 votes
3 answers
21k views

Why is setting Nginx as a reverse proxy a good idea?

I have a Django site running on Gunicorn with a reverse proxy through Nginx. Isn't Nginx just an extra unnecessary overhead? How does adding that on top of Gunicorn help?
TheOne's user avatar
  • 605
46 votes
5 answers
49k views

How do I make uWSGI restart when a Python script is modified?

Can't remember where, but I read uWSGI can reload itself like Django development server when a project script is modified. I can't find that in the docs, nor in the internets. How can I do this? I ...
culebrón's user avatar
  • 575
27 votes
2 answers
22k views

How many processes should I specify in a WSGIDaemonProcess while running Django through mod_wsgi?

Let's say I have 2 sites(Superuser and Serverfault) running from their own Apache virtual host on one box. The 2 sites are powered by Django and are running on Apache with mod-wsgi. A typical ...
Thierry Lam's user avatar
  • 6,281
24 votes
1 answer
14k views

Django: CONN_MAX_AGE persists connections, but doesn't reuse them with PostgreSQL

I've got a django setup are using Django 1.6.7 and Postgres 9.3 on Ubuntu 14.04 LTS. At any given time, the site gets about ~250 simultaneous connections to the PostgreSQL database, which is a Quad ...
synic's user avatar
  • 793
21 votes
6 answers
54k views

Why is Nginx more popular than lighttpd?

I'd like to use Lighttpd in production for serving Django apps but i see that these days Nginx is more and more popular. Why is that? I'm aware that in the past Lighttpd had memory leaks but isn't ...
daniels's user avatar
  • 1,215
18 votes
4 answers
21k views

Which is best for Django? Lighttpd or Nginx? Or maybe something else? [closed]

Which of Lighttpd and Nginx is, basing on your experience, better suited for Django? I've used both and can hardly notice any difference at all, they just work fine... Are there any use cases when one ...
18 votes
5 answers
27k views

WSGI : Truncated or oversized response headers received from daemon process

System Configuration : Apache2, Django 1.10, Python 3, Ubuntu 16.04 LTS Django debug=True. /var/log/apache2/error.log [52:53.057967] [wsgi:error] [pid 4303] [client 1.1.1.22:24409] Timeout when ...
Suraj's user avatar
  • 449
16 votes
2 answers
23k views

Wiring uWSGI to work with Django and nginx on Ubuntu 16.04

I am trying to follow this tutorial to setup uWSGI with Django and nginx on Ubuntu16.04. It all works fine up until the very last step (oh the irony...) where I try to execute this command: sudo ...
Vlad Schnakovszki's user avatar
15 votes
2 answers
5k views

Not seeing Django logs on Heroku

I'm not seeing log entries (at a level of INFO) made by Django in my Heroku logs. This is my configuration: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { ...
Ram Rachum's user avatar
  • 5,261
14 votes
4 answers
3k views

Deploying Django App with Nginx, Apache, mod_wsgi

I have a django app which can run locally using the standard development environment. I want to now move this to EC2 for production. The django documentation suggests running with apache and ...
JCWong's user avatar
  • 241
13 votes
4 answers
8k views

Nginx Varnish Nginx Django?

I have a django app and I want to to setup Varnish on a server in front of it. In another serverfault thread somebody suggested putting Nginx in front of Varnish. Should I put Nginx in front of ...
Enrico's user avatar
  • 491
13 votes
3 answers
77k views

Help me understand how to use ProxyPass

UPDATE: I added a revised question after playing around with it two answers below. Hi there, If you're reading this you're probably familiar with Apache's mod_proxy and its ProxyPass function. Like ...
user avatar
12 votes
6 answers
3k views

Is there a Heroku for Django?

I've been looking into Heroku as a hosting provider. I'm specifically interested in its ease of deployment and ability to scale up and scale down resources as needed. Is there a hosting solution ...
Chris Dutrow's user avatar
11 votes
3 answers
8k views

How to set up Django with IIS 8?

I have tried in the past to get Django running under IIS 8 in Windows 8 Developer Preview. Now that the Consumer Preview of Windows 8 is out, I was wondering if I could get some detailed instructions ...
Nathan Osman's user avatar
  • 2,725
11 votes
1 answer
7k views

Storing username in nginx logs

Is there a way in which user-name or user-id can be stored in nginx logs. I tried inserting $remote_user in the log_format directive but it doesn't seem to work.
nishant's user avatar
  • 113
11 votes
5 answers
8k views

Amazon EC2 Ami recommendations for free tier?

Amazon web services recently introduced a free tier, where you basically get free stuff to try out AWS and run tiny sites and projects. Basically it's free as long as you remain below a certain limit ...
Console's user avatar
  • 447
11 votes
1 answer
9k views

Risks of using django manage.py runserver for production in a small scale server, for internal use?

I am writing a small web-app with django. It will have no more than 200 users, all internal to my company. I want to set it up as quickly as possible. I am new to django and web-apps. As I read ...
a06e's user avatar
  • 373
10 votes
2 answers
4k views

High CPU load on Django/Apache/mod_wsgi site

Load testing a django 1.21/Apache/mod_wsgi configuration on an AWS small instance (Ubuntu 10.04) with Apache bench is showing extremely high CPU load (using uptime and vmstat) at low concurrent ...
litterbug's user avatar
  • 121
10 votes
4 answers
2k views

nginx + fastCGI + Django - getting data corruption in the responses sent to the client

I am running Django behind nginx using FastCGI. I have discovered that in some of the responses sent to the client, random data corruption is occurring in the middle of the responses (might be a ...
glenc's user avatar
  • 273
9 votes
2 answers
33k views

nginx not serving admin static files?

Clarification: The following error is onlyfor the admin static files, i.e. it is specific to the static files corresponding to the Django admin. The rest of the static files are working perfectly. ...
toto_tico's user avatar
  • 191
9 votes
3 answers
20k views

Invalid HTTP_HOST header. The domain name provided is not valid according to RFC 1034/1035

I am getting Invalid HTTP_HOST header error on my server. I don't understand why it's happening and how to fix it. Everytime it happens backend stops working and I have to restart the server. Any help ...
Chetan Ganji's user avatar
9 votes
3 answers
4k views

How to explain Django/Python installation to Python-newbie running a shared IIS server [closed]

For reasons beyond my control, our website is hosted with a hosting provider that uses IIS for their servers. They currently offer PHP and ASP, and also Python and Perl through cgi-scripts. I want to ...
Epcylon's user avatar
  • 217
9 votes
1 answer
6k views

uWSGI Returning Empty Response

I have a Django site which I am trying to server via uWSGI. I have started the server like so: uwsgi --emperor . Ctrl+Z bg 1 (There are two .ini files which point to the test version and production ...
d4nt's user avatar
  • 265
9 votes
1 answer
7k views

Celery Daemon receives unregistered tasks

I installed Celery for my Django project following what the official tutorial / doc says. And it's working fine when I launch celery at the command line, I can see it receiving the tasks and execute ...
Bastian's user avatar
  • 283
9 votes
1 answer
9k views

Apache/wsgi "Script timed out before returning headers"

I have a custom Django app that's becoming unresponsive roughly every 5,000 requests. In the apache logs, I see see the following: Apr 13 11:45:07 www3 apache2[27590]: **successful view render here** ...
Chase Seibert's user avatar
8 votes
3 answers
6k views

Which Apache package is best for mod_wsgi Django application?

In Ubuntu (and Debian, and other distro) there is a few Apache packages (mpm-event, mpm-prefork, mpm-worker). Which is the most suitable for hosting Django mod_wsgi application on single CPU server? ...
miHost's user avatar
  • 183
8 votes
5 answers
17k views

Why do I get error, Invalid command 'PythonHandler'?

I'm trying to deploy a Django application, but I've hit a brick wall. On Debian (latest), I've run these commands so far: apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils ...
Nick Bolton's user avatar
  • 5,136
8 votes
4 answers
10k views

gunicorn + django + nginx unix://socket failed (11: Resource temporarily unavailable)

Running very high volume traffic on these servers configured with django, gunicorn, supervisor and nginx. But a lot of times I tend to see 502 errors. So I checked the nginx logs to see what error and ...
user1068118's user avatar
8 votes
2 answers
15k views

Long running requests with gunicorn + nginx

I've put together an integration server for our Django-powered application. A few of the features are still experimental, and result in overly long requests. I'm okay with the poor performance, for ...
Matt Luongo's user avatar
8 votes
1 answer
45k views

Python/Django/WSGI/Apache - "ImportError: No module named site"

I am trying to use a django application on my local ubuntu machine. However the site doesn't work and my /var/log/apache2/errors.log is filled with messages like this: ImportError: No module named ...
Amandasaurus's user avatar
  • 31.9k
8 votes
4 answers
5k views

How to set environment variables for the CI/CD in GitLab when using Auto DevOps (with GCP Kubernetes)?

I'm having quite a few moving parts here, so, I'm not sure what's wrong yet. I set up my variable this way: but during the build phase, I get this failure (it's a Django application): raise ...
Pablo Fernandez's user avatar
8 votes
1 answer
28k views

psycopg2 not found by django after installing in virtualenv

I want to use postgresql with django so did the following: sudo apt-get install libpq-dev python-dev sudo apt-get update workon myenv sudo pip install psycopg2 And after configuring my settings.py ...
user avatar
8 votes
1 answer
8k views

What user should run the gunicorn process?

When running a Django application on a Debian server, should you create some sort of application user (e.g. "myappuser") and run the gunicorn process as that user or can/should gunicorn be run as ...
Jim's user avatar
  • 340
7 votes
2 answers
12k views

Setup CNAME for subdomain issue

I would setup for this: user go to test.example_site1.org test.example_org1.org it's a CNAME of test.example_org2.org user will see the page of test.example_org2.org On the example_org2.org server I ...
Fred Collins's user avatar
7 votes
1 answer
3k views

gunicorn not fully reloading after an HUP signal

I'm trying to get a working supervisor/gunicorn/django setup on vagrant. I am using python-watchdog to try and restart gunicorn when code changes happen. I am using the following supervisor ...
synic's user avatar
  • 793
7 votes
1 answer
5k views

Running django custom management commands with supervisord

I'd like to use supervisord to run some commands for my Django project but I keep getting the following error: supervisor.log: 2012-05-18 17:52:15,784 INFO spawnerr: can't find command 'source' If ...
mfsaint's user avatar
  • 201
7 votes
1 answer
4k views

Cron job running a Django Python command through a virtual environment not working

I have a crontab file supposedly executing a Django command after loading the project virtual environment: */1 * * * * source /home/virtualenvs/mydjangoproject-venv/bin/activate && python /...
bolino's user avatar
  • 275
7 votes
4 answers
35k views

ubuntu + nginx + uwsgi + django No Python application found

I am trying to setup my server with a nginx to uwsgi to django stack, but I am having problems with the uwsgi part. When I run uwsgi and pass in all the parameters on the command line, it works ...
OpIvy's user avatar
  • 113
7 votes
3 answers
26k views

Supervisor process exits with 'exit status 1; not expected'

I'm trying to run a gunicorn_django process in supervisor but it always exits immediately, giving this error: INFO exited: my_app (exit status 1; not expected) INFO received SIGCLD indicating a ...
Sævar's user avatar
  • 201
7 votes
1 answer
6k views

Django + gunicorn + virtualenv + Supervisord issue

I have a strange issue with my virtualenv + gunicorn setup, only when gunicorn is launched via supervisord. I do realize that it may very well be an issue with my supervisord and I would appreciate ...
Florian Le Goff's user avatar
7 votes
1 answer
40k views

How to get nginx to pass HTTP_AUTHORIZATION header to Apache

Am using Nginx as a reverse proxy to an Apache server that uses HTTP Auth. For some reason, I can't get the HTTP_AUTHORIZATION header through to Apache, it seems to get filtered out by Nginx. Hence, ...
codeinthehole's user avatar
7 votes
1 answer
4k views

Python Threads and uWSGI Harakiri

I have a webapp that is using an API built on nginx, uWSGI, and Django. Recently I have been seeing a lot of harakiris on a particular API call which does some quick processing and then spawns a few ...
jmetz's user avatar
  • 181
6 votes
3 answers
6k views

Using Nginx to Block Connections that aren't addressed to my domain

I am running a django app on AWS elastic beanstalk and I'm getting spammed by bots trying to scan for vulnerabilities. It results in a flood of errors such as: (Where xx.xxx.xx.xx is my ec2 instance's ...
Del's user avatar
  • 163
6 votes
2 answers
17k views

nginx+django serving static files

I have followed instruction for setting up django with nginx from the django wiki (https://code.djangoproject.com/wiki/DjangoAndNginx) and have nginx setup as follows (a few name changes to fit my ...
avalore's user avatar
  • 63
6 votes
4 answers
15k views

How do I implement SSL on a private IP?

I am developing a network management product. We ship our product to customers as a VM, which they install on a hypervisor in their network. These VMs are given static, private IP addresses in the ...
BThompson's user avatar
  • 191
6 votes
2 answers
22k views

Django doesn't find CSS files for admin pages using uWSGI

Even if I followed the official instructions, when I start a Django test site using uWSGI, CSS files for the admin interface are not loaded. If I open the URL of a CSS file, for example http://...
Marco Sulla's user avatar
6 votes
3 answers
5k views

Is it possible to run automatically celery at startup?

I have python server based on django and celery. Each time computer restarts, apache2 starts so my server is working, BUT I have to restart celery manually (going to my project directory and executing ...
user avatar

1
2 3 4 5
21