Tag Archives: django

HTTP_AUTHORIZATION header in Django

Questions: I wrote a simple check in django which requires an access token to be passed along in some requests (I’m using a decorator). authorization = request.META.get(‘HTTP_AUTHORIZATION’, None) # Forbid access when no access token, or an invalid one, is provided form = AccessTokenForm({ ‘access_token’: authorization }) if not form.is_valid(): raise exceptions.HttpDeniedException() This has been… Read More »

Deploy Django project on RedHat

Questions: I’m trying to deploy my local Django project on my RedHat server. So I install all the libraries and dependencies that I needed (also mod_wsgi). So, I edit my project’s settings and move my local project to the server. But I’m facing an issue: when I try to reach the URL of my project,… Read More »

How do I handle blocking IO in mod_wsgi/django?

Questions: I am running Django under Apache+mod_wsgi in daemon mode with the following config: WSGIDaemonProcess myserver processes=2 threads=15 My application does some IO on the backend, which could take several seconds. def my_django_view: content=… # Do some processing on backend file return HttpResponse(content) It appears that if I am processing more than 2 http requests… Read More »

Python or Jython for Django based application?

Questions: We are going to start developing Django based application. It requires speed optimisation (need to serve k+ requests/sec), n number of nodes with HAproxy and PostgreSQL load-balancing. Presently we consider using Python, Apache, memcached Jython, Glassfish The application should scale overtime, Python or Jython. Any suggestion? Answers: Which language you know better? JVM based… Read More »

SSL based virtual host with django and mod_wsgi

Questions: I have a django web application in which some URLs are allowed to be accessed over http while others have to be over http-secure only. I need to set up the virtualHost/ mod_wsgi configuration in my apache conf file, so that the same web application can be accessed over both. I followed these 2… Read More »

Two separate django sites in WSGI (root and /two)

Questions: After hours of trying I’ve decided to give in and ask SO for help 🙂 I have two Django 1.6 sites running on Apache2 on Debian 7. I have one vhost. I want the root domain for the vhost to go to one django site (example: mydomain.com), and a separate alias for the second… Read More »

Django getting lots of SuspiciousOperation: Invalid HTTP_HOST header

Questions: I’m using Django 1.5, Apache, mod_wsgi and python 2.7, debian hosted on linode. Since I upgraded from django 1.3 to django 1.5, I started receive some error messages, for example: “ERROR (EXTERNAL IP): Internal Server Error: /feed/”. With this traceback: Traceback (most recent call last): File “/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py”, line 92, in get_response response = middleware_method(request)… Read More »

Apache / Django – CSS Not loading on Alias

Questions: My CSS / JS is not loading when using an alias in the httpd.conf The site loads with all static files when using the localhost WSGIScriptAlias / “d:\www\python\skillshare\src\mvp_landing\wsgi.py” result; http://localhost/ The site loads but with no css and js when adding the alias WSGIScriptAlias /picon “d:\www\python\skillshare\src\mvp_landing\wsgi.py” result; http://localhost/picon/ My Current Dir structure below; D:\www\python\skillshare\src\mvp_landing\wsgi.py… Read More »