multiple django sites with apache & mod_wsgi

Your ServerName/ServerAlias directives are wrong. ServerName should be hostname. You probably should just delete ServerAlias. Then just do the obvious and duplicate VirtualHost/Listen directives, just changing the port number and locations of scripts in the file system. Finally, do not set DocumentRoot to be where your Django code is as it makes it easier to … Read more

Debugging Apache/Django/WSGI Bad Request (400) Error

Add the ALLOWED_HOSTS setting to your settings.py like so… ALLOWED_HOSTS = [ ‘.example.com’, # Allow domain and subdomains ‘.example.com.’, # Also allow FQDN and subdomains ] I had this same problem and found the answer here in the docs update: django 1.6 docs are no longer online, I updated the link to go to the … Read more

In production, Apache + mod_wsgi or Nginx + mod_wsgi?

For nginx/mod_wsgi, ensure you read: http://blog.dscpl.com.au/2009/05/blocking-requests-and-nginx-version-of.html Because of how nginx is an event driven system underneath, it has behavioural characteristics which are detrimental to blocking applications such as is the case with WSGI based applications. Worse case scenario is that with multiprocess nginx configuration, you can see user requests be blocked even though some nginx … Read more

Target WSGI script cannot be loaded as Python module

For me the problem was wsgi python version mismatch. I was using python 3, so: $ sudo apt-get remove libapache2-mod-python libapache2-mod-wsgi $ sudo apt-get install libapache2-mod-wsgi-py3 Warning from @alxs before you copy/paste these commands: If there are python 2 projects running on the server that use wsgi and apache, the above commands will effectively shut … Read more

Unable log in to the django admin page with a valid username and password

Steps to debug: Make sure that your Database is synced Double check that you have a django_session table Try to authenticate Do you see a record being created in the django_session table? IF NOT remove non-standard settings AUTHENTICATION_BACKENDS = (‘django.contrib.auth.backends.ModelBackend’,) SESSION_EXPIRE_AT_BROWSER_CLOSE = True SESSION_SAVE_EVERY_REQUEST = True SESSION_COOKIE_AGE = 86400 # sec SESSION_COOKIE_DOMAIN = None SESSION_COOKIE_NAME … Read more

Python : How to parse the Body from a raw email , given that raw email does not have a “Body” tag or anything

To be highly positive you work with the actual email body (yet, still with the possibility you’re not parsing the right part), you have to skip attachments, and focus on the plain or html part (depending on your needs) for further processing. As the before-mentioned attachments can and very often are of text/plain or text/html … Read more

Django stops working with RuntimeError: populate() isn’t reentrant

This is caused by a bug in your Django settings somewhere. Unfortunately, Django’s hiding the bug behind this generic and un-useful error message. To reveal the true problem, open django/apps/registry.py and around line 80, replace: raise RuntimeError(“populate() isn’t reentrant”) with: self.app_configs = {} This will allow Django to continue loading, and reveal the actual error. … Read more

Difference between socket and websocket?

To answer your questions. Even though they achieve (in general) similar things, yes, they are really different. WebSockets typically run from browsers connecting to Application Server over a protocol similar to HTTP that runs over TCP/IP. So they are primarily for Web Applications that require a permanent connection to its server. On the other hand, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)