welcome: please sign in

Diff for "MemberManual/WebApplications/Django"

Differences between revisions 5 and 7 (spanning 2 versions)
Revision 5 as of 2010-02-13 15:36:46
Size: 1028
Editor: NachtDier
Comment:
Revision 7 as of 2010-02-13 15:44:36
Size: 1738
Editor: NachtDier
Comment:
Deletions are marked like this. Additions are marked like this.
Line 15: Line 15:
You need to organize a couple of things in the Apache configuration file. First of all, you want an alias for your "favicon.ico". With a static web-site the favicon is in the document root. I prefer the favicon in the same directory as my other static media. Therefore you need an alias for the directory with your static media, as well as an alias for your favicon === Static media ===
You need to organize a couple of things in the Apache configuration file. First of all, you want an alias for your "favicon.ico". With a static web-site the favicon is in the document root. I prefer the favicon in the same directory as my other static media. Therefore you need an alias for the directory with your static media, as well as an alias for your favicon. Don't forget to add the Directory entry for this directory.
Line 17: Line 18:
{{{!#highlight apache {{{#!highlight apacheconf
Line 20: Line 21:
}}}

For the Admin part of your Django project you will probably use the default Django admin pages and media files. Add a symbolic link to your Django directory (don't forget to add followsymlinks to your Apache configuration) and configure that one too.

{{{#!highlight apacheconf
alias /media/ /YOURPROJECT/media/
Line 26: Line 33:

You need to have a special WSGI script in your Django project. Don't put this one in the same directory as your settings file but use a subdirectory. Only then you can enter a separate Directory with the appropriate allow and deny. You don't want to expose your directory with your settings file.

1. Apache

1.1. Introduction

Download the

Follow the instructions on RunningYourOwnApache.

1.2. MOD_WSGI

Download the latest version from http://apache.org

1.3. HTTPD.conf

1.3.1. Static media

You need to organize a couple of things in the Apache configuration file. First of all, you want an alias for your "favicon.ico". With a static web-site the favicon is in the document root. I prefer the favicon in the same directory as my other static media. Therefore you need an alias for the directory with your static media, as well as an alias for your favicon. Don't forget to add the Directory entry for this directory.

   1 alias /favicon.ico /YOURPROJECT/site_media/favicon.ico
   2 alias /site_media/ /YOURPROJECT/site_media/

For the Admin part of your Django project you will probably use the default Django admin pages and media files. Add a symbolic link to your Django directory (don't forget to add followsymlinks to your Apache configuration) and configure that one too.

   1 alias /media/ /YOURPROJECT/media/

2. Django

2.1. WSGI

You need to have a special WSGI script in your Django project. Don't put this one in the same directory as your settings file but use a subdirectory. Only then you can enter a separate Directory with the appropriate allow and deny. You don't want to expose your directory with your settings file.

2.2. Settings.py

2.3. More information

3. Alternatives

3.1. Django_cpserver

The application CherryPy is also very good in serving Python applications. CherryPy is also a Web Framework, but you can use it for serving only.

MemberManual/WebApplications/Django (last edited 2013-01-14 07:17:48 by ClintonEbadi)