Django and Staticgenerator

apps

#1

Hi,

I am trying to use the staticgenerator for my django site.
The site contains only config for Nginx servers.
So, i followed this http://nemesisdesign.net/blog/coding/setup-django-staticgenerator-apache-mod_wsgi/

But that config is not working in my Dreamhost PS, since the link contains only for apache-wsgi-django.
In Dreamhost, passenger is there.

The issue in all is that the static cache is getting generated but the files are recached every time i refresh my site.
Seems i need something to do in the Passenger level.

Can anyone help me in this pls?
If the staticgenerator works my site will handle 6000-7000 requests per sec.


#2

Where are you putting the static files? They should be going into the “public” directory under the directory containing your passenger_wsgi script.


#3

@andrew
I installed it on the public folder only.
I gave the WEB_ROOT as /home/user/example.org/public/static in settings.py
the wsgi is in /home/user/example.org/public

As i said the caching is happening but it re-caches everytime i refresh my website.
Actually, in my virtualhost,

# this tells apache to serve any file that match the request RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f # this tells apache to serve the index.html produced by StaticGenerator RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index.html !-f RewriteRule ^/(.*)$ /home/user/example.org/public/myscript.wsgi/$1 [QSA,L,PT]
I gave these code after the phpmyadmin rewrite.

Seems theres a rule somewhere after this that refetches the content making the cache overwritten everytime i refresh.

Was it right? If yes, then can it be said that which lines in the virtualhost entry does this?


#4

Wait, what? That script is completely incorrect. Where did you get that from? If you’ve set up Django correctly using Passenger WSGI, you should not need any code in your .htaccess file at all, as Passenger automatically detects and uses static files in the “public” directory.


#5

@andrewf
What i said was not in htaccess but in apache.conf
And if the rules are wrong what is the right way to tell passenger to use the static files generated by the staticgenerator?


#6

You shouldn’t have to add anything. Passenger will automatically send files from the public directory if they exist, and fall back to hitting your application for files/paths that don’t exist in there.


#7

Hi andrew,
But where is the public folder of passenger existing??


#8

If you have set up Passenger correctly, there should be a directory called “public” in the domain directory.


#9

ok thank you for your help.
i changed the WEB_ROOT for the staticgenerator to the DocumentRoot of my site.
Its working now.