On 27-Oct-07, at 11:29 PM, Adam D. wrote:

> Everywhere I read about django, it suggests to put your django project
> outside of your servers document root.

the only thing you should put in document root is your favicon
>
> My question is if my document root is '/var/www/vhosts/domain.com/
> doc_root' and I put my project outside of that root, at '/var/www/
> vhosts/domain.com/django_site' how do i link it to my 'doc_root', so
> when i go to http://www.domain.com, it serves my djano site?

your site should not be under /var at all. It should be in your home  
directory. You use the Alias and Location directives in your apache  
config to find your files. Here is a sample apache config where  
sitemedia is for the static media files, and smedia is for the media  
uploaded to the site.

<VirtualHost *:80>
         ServerAdmin [EMAIL PROTECTED]
         ServerName conference.web
         ServerAlias www.conference.web
         DocumentRoot /opt/local/apache2/htdocs/conference
         ErrorLog /opt/local/apache2/logs/conference_error.log

         # Possible values include: debug, info, notice, warn, error,  
crit,
         # alert, emerg.
         LogLevel warn

         CustomLog /opt/local/apache2/logs/access.log combined

     Alias /media/ "/Users/lawgon/django_src/django/contrib/admin/ 
media/"
     Alias /smedia/ "/Users/lawgon/media/"
     Alias /sitemedia/ "/Users/lawgon/programs/conference/sitemedia/"


     <Directory /Users/lawgon/programs/conference/templates/>
       Order deny,allow
       Allow from all
     </Directory>

     <Directory /Users/lawgon/media/>
       Order deny,allow
       Allow from all
     </Directory>

     <Directory /Users/lawgon/programs/conference/sitemedia/>
       Order deny,allow
       Allow from all
     </Directory>

     <Directory /Users/lawgon/django_src/django/contrib/admin/media/>
       Order deny,allow
       Allow from all
     </Directory>

     <Location "/web/">
       SetHandler python-program
       PythonHandler django.core.handlers.modpython
       SetEnv DJANGO_SETTINGS_MODULE conference.settings
       PythonInterpreter conference_main
       PythonDebug On
     </Location>

</VirtualHost>

and from settings.py:

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/Users/lawgon/media'

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com";
MEDIA_URL = 'http://conference.web/smedia/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure  
to use a
# trailing slash.
# Examples: "http://foo.com/media/";, "/media/".
ADMIN_MEDIA_PREFIX = '/media/'



-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to