Running Django on OpenBSD...best practices?

374 views
Skip to first unread message

Tim Chase

unread,
Jan 9, 2007, 5:54:17 PM1/9/07
to django...@googlegroups.com
I'm setting up an OpenBSD server and would like to start testing
some projects using Django. Are there any bits of sage advice
that could be given? At this point, I'm not tied to anything
else (Apache vs. Lighttpd; mod_python vs. WSGI; etc).

Some of the speedbumps that I've come across in my research:

- mod_python and the stock Apache (1.3 family) on OpenBSD don't
seem to play nicely, which would mean that if one went with
mod_python, I'd have to upgrade to Apache2 (which would be a
compilation process, not just a simple "pkg_add")

- There seem to be gripes about the process of getting Django to
run via WSGI with Lighttpd
(http://sayspy.blogspot.com/2006/09/ignorant-newbie-running-django-using.html)

The planned site will see modest volume of traffic, but the
server should be more than able to keep up.

Any suggestions for which direction I should pursue? (Building
Apache2 + building mod_python) Options I haven't uncovered?

I'd appreciate any suggestions, ideas, or feedback,

Thanks,

-tkc


Guillermo Fernandez Castellanos

unread,
Jan 9, 2007, 6:19:04 PM1/9/07
to django...@googlegroups.com
Hi,

Another option that has been considered by more and more people is Nginx.
This page it's in polish, but the configuration files are pretty understandable:
http://www.python.rk.edu.pl/w/p/django-pod-serwerem-nginx/
A podcast is here:
http://mx.bw.rulez-forever.com/Django-Nginx-FastCGI-screencast-1024.avi

Nginx is an HTTP server and proxy server that understands FastCGI
natively. It is fairly easy to configure and can serve static files
while redirecting requests to FastCGI instances.

Just an extra option to consider.

G

johnnie pittman

unread,
Jan 9, 2007, 7:38:45 PM1/9/07
to django...@googlegroups.com
On 1/9/07, Tim Chase <django...@tim.thechases.com> wrote:

Any suggestions for which direction I should pursue?  (Building
Apache2 + building mod_python)  Options I haven't uncovered?

I went this route under OpenBSD 3.9 and have had very few issues.  The most trouble I had was with getting mod_python to compile correctly, mostly related to path issues of where I had installed python. 

If you need any help, go ahead and email me directly.

Johnnie

Tim Chase

unread,
Jan 11, 2007, 5:21:26 PM1/11/07
to django...@googlegroups.com
>> Any suggestions for which direction I should pursue? (Building
>> Apache2 + building mod_python) Options I haven't uncovered?
>
>
> I went this route under OpenBSD 3.9 and have had very few issues. The most
> trouble I had was with getting mod_python to compile correctly, mostly
> related to path issues of where I had installed python.
>
> If you need any help, go ahead and email me directly.

Thanks for the suggestions. I finally managed to get:

- Apache upgraded to 2.0 (as 2.2 barfed on compile) moved to /var
rather than the default deployment directory in /usr (which will
be locked down, mounted readonly)
- mod_python installed
- freetds (for talking to SQLServer)
- pymssql (for interfacing python and freetds)
- postgresql (the eventually planned target for deployment)
- django (both the trunk and row-level-permissions branch, with
soft-links to make it easy to switch between them)

all on the system. It wasn't a facile process, especially after
chasing down a dark path of trying to get iODBC+freetds+mxODBC
working to talk to SQLServer. A nightmare, that.
FreeTDS+pymssql is much kinder for such purposes.

Apache is now configured to serve two django folders via
django+mod_python, and serve general media (and the admin media)
from a non-django'd directory. I should image the bloody drive
now before I break it again :)

It also took a few tries to get the syntax of the section in
httpd.conf file right, so that files were in the right place,
with and without various levels of path/ext (and using dots vs.
slashes in various places). Perhaps a little expansion in the
online-help could help slower folks like myself. :)

All the config files have been snapshotted at least, using the
venerable RCS.

I'd still be interested in getting lighttpd+fastcgi/WSGI working
just to prove it's possible (and perhaps to compare speed).

Thanks for your various suggestions.

-tkc

Reply all
Reply to author
Forward
0 new messages