djapian based search freezes - django

When I try to run a djapian based search it freezes the applications and I dont get any response from the server. Am deploying the site using mod_wsgi. The search runs fine when i run it in the python shell or in the django dev server. The problem seems to arise only when I deploy my site to apache. Does anyone know how I can get around this issue?

I ran into the same problem when I started using Djapian. You should be able to work around this problem by adding the following to your Apache site
configuration file:
WSGIApplicationGroup %{GLOBAL}
More information on the subject is available here: http://trac.xapian.org/ticket/185 and there's a related ticket for Djapian here: http://code.google.com/p/djapian/issues/detail?id=35

Related

Apache webserver with app using GDAL not working on windows

I am trying to deploy a django project using POSTGIS on my windows 11 PC with Apache 2.4.
The web page is working as long as I am not using 'django.contrib.gis'.
When I add 'django.contrib.gis' to my INSTALLED_APPS and define GDAL_LIBRARY_PATH to point to my gdal installation things stop working.
Specifically, trying to access the web app ends up in infinitely loading the page. Weird enough there are no errors in the apache error log. The apache service starts fine.
As far as I can see gdal install is correct as the app is working fine on the same machine with the same python environment with the django development server.
Actually, I have the same issue with other python libraries that need some dlls, like opencv.
So my guess is that it is a security related issue, but I do not find any clues on how to solve it.
Any ideas?
I tried also to grant rights to the directory where gdal is install in apache conf. But no luck.

ubuntu django and apache, cannot find the site

I am brand new to web app development and thought I would try django as I am familiar with python. I followed the following guide: http://www.lennu.net/2012/05/14/django-deployement-installation-to-ubuntu-12-dot-04-server/ to deploy a django page to the letter. However, I now realize that this guide was for the server version of the OD and i'm running the desktop version. When I try to open my site in chrome (amitash.r) it fails with a page not found. Now when I open localhost, I get an internal server 500 error. All my config files are exactly as stated in the guide. Any fixes?
Can you post your mod_wsgi script and Apache VirtualHost file?
Following the instructions from the link you gave, the mod_wsgi script should be in:
/srv/my_project/app/conf/apache/django.wsgi
The VirtualHost file location from the link should be:
/etc/apache2/sites-available/DOMAIN
Make sure you enabled your site. If you named your file DOMAIN, like the instructions, you should enable the site using:
a2ensite DOMAIN

Django through apache

I am having a great deal of trouble deploying a django website written for 1.3 behind apache using django 1.4 and wsgi. There is also a wordpress site running on the same domain too. Ideally I would like to have django site running on [domain]/app/.
Does anybody have any links to a good tutorial. I am having a lot of trouble working out where to put wsgi.py file. It keeps saying it cannot find it.
When I was recently working to deploy my first django project, I found this tutorial helpful. It independently tests if django and wsgi are working using simple "hello world" applications for each and gives an example of how to make the wsgi.py file work right. I think it's not really a question of putting wsgi.py in the right place; it's more a question of telling Apache where wsgi.py is. If you can get the tutorial working it ought to be relatively straightforward to get your full django site working.
For the Django site, should simply be a matter of having:
WSGIScriptAlias /app /some/path/project/wsgi.py
In other words, the '/app' mount point is used with WSGIScriptAlias instead of '/' that many examples use.
If using login features, you may also need to set LOGIN_URL etc in Django settings file however, as it doesn't automatically incorporate in the mount point.

Django Apache2 mod_wsgi flatpages admin not working

I finally got apache2 with mod_wsgi working on Linux (havent much luck with windows :D) and everything works fine, but now when I added flatpages to my project, I found out that Apache doesn't seem to be aware of URL for admin when trying to create new flatpage via admin.
It says
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1/admin/flatpages/flatpage/1/
And now I noticed that when I'm on admin front page, and hit F5 again and again, flatpages admin appears and disappears, but nothing like this happens when using dev server, so I'll try to create new project with default setting and see what it'll do in apache and in dev server, did anyone came across this kind of error?
The Django dev server auto-reloads your code when you change it, but Apache does not.
If you are running mod wsgi in daemon mode, you can reload the code by touching the wsgi script.
touch myproject/mysite.wsgi
Otherwise, you may have to restart apache. For example
/etc/init.d/apache2 restart

how to restart single apache site on a ubuntu vps rather than all sites

I've got a ubuntu vps and apache mod wsgi installed and serving my django sites.
however i have to restart all of apache rather than the site i have amended and its going to be a bit shonky if i tell clients that i have restarted their site cos i updated another site.
is there a tutorial somewhere to teach me how to configure this? i couldnt find one in googles keywords soup.
I'm already using virtualenvs if it helps.
Assuming you use mod_wsgi in daemon mode on UNIX/Apache 2.X system to run Django and have shell access to your machine all you need to do is touch the wsgi configuration for your project.
touch your_project.wsgi
See mod_wsgi documentation on Reloading Source Code and Django - mod_wsgi wiki for more references.