Re: site styling works with development server but not apache
Progress!! I had to add Alias /adminmedia "/usr/lib/pymodules/python2.6/django/contrib/admin/media" and set ADMIN_MEDIA_PREFIX to the same url /adminmedia/ I don't understand everything yet, and will probably have more problems soon. But at least I got this far. Thanks for all the help!! On Thu, Feb 17, 2011 at 1:10 PM, Mike Ramirezwrote: > On Thursday, February 17, 2011 09:23:47 am you wrote: > > > I'm still having trouble. My directory structure is: > > > > > > /usr/local/www/static > > > > > > +- contrib/admin/media -- symlink to django/contrib/admin/media > > > > > > +- media/admin/base_site.html -- modified version of base_site.html > > > > > > I've tried every combination of the following, but nothing is working: > > > > > All you need here is the /usr/local/www/static any subdirectories here > should be served as normal, like http://localhost/contrib/admin/media > > The admin template, You do not want it here. it should be in your template > dir see the doc below this for that. > > > http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin-look-and-feel > > > DocumentRoot /usr/local/www/static > > > - does this need to be set at all? > > > > > No. > > > Alias /media/ /usr/loca/www/static/... > > > - not quite sure which directory this should point to > > > - I've tried all sensible options, but none work > > > > > Should be the absolute path to where you store your project media. > > > ADMIN_MEDIA_PREFIX = '/media/' > > > - Does this simply have to be equal to whatever URL is used in the Alias > > > directive above? > > > > > It needs to be another alias to the absolute path of the adminmedia. > > > Thank you. > > > > > Ok, this is a setup I have working (when the site/backend isn't broken > ;)), This one is meant to work with nginx as a gateway serving my media and > proxying back to my apache config, but it should work fine without nginx. > This is also mod_wsgi specific, but you can add mod_python settings. > > Please read the comments, domain is the domain of this box. $USER is the > username on the system. (these removed for security reasons). > > > > # basics for named based virtual hosts > > ServerName priss.domain.com > > ServerAlias domain.homelinux.org > > ServerAdmin webmas...@domain.com > > # this is the root url path. > > # I believe this can be omitted.. graham can verify or deny > > # either way it works as expected with this set > > ServerPath / > > # custom log paths. > > ErrorLog > /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.error_log > > CustomLog > /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.access_log > combined > > # mod wsgi settings. > > # adjust threads per system. > > # wrap with the IfModule so I can also add mod_python directives > > # and let apache decide what to used based on the module loaded/used. > > > > WSGIDaemonProcess blog user=$USER group=$USER threads=100 > > WSGIDaemonProcess pastebin user=$USER group=$USER threads=100 > > # paster > > # this is a custom pastebin project that is served on a > > # subpath of the main url. this comes first before the main site > > # is served so that the main projects urls.py does not search > > # for this path > > # please note this is a completely different project served > > # as part of the main site. > > # (no control over subdomains on this box). > > # > > WSGIScriptAlias /paster > /home/srv/$USER/web/projects/pastebin/apache/paster.wsgi > > > > # to make sure this runs in it's own interpretter. > > WSGIApplicationGroup pastebin > > Order deny,allow > > Allow from all > > > > # this is the main project/site served on the root of the urls path > > . > > WSGIScriptAlias / /home//srv/$USER/gufy/domain_com/apache/gm.wsgi > > > > WSGIApplicationGroup blog > > Order deny,allow > > Allow from all > > > > > > ### these are the parts you want. > > # /media serves all my main projects media. > > # these do not conflict with WSGIScriptAlias > > # Alias has a higher precedence than WSGIScriptAlias. > > # MEDIA_ROOT = /var/www/htm/media > > # > > Alias /media /var/www/html/media > > > > SetHandler None > > Order deny,allow > > Allow from all > > > > # this is the admin media. > > # ADMIN_MEDIA_URL = "/adminmedia/" > > # serves admin media for both projects. > > # /var/www/html/adminmedia is a copy of the django admin media found in > > # django/contrib/admin/media ... I'm not a fan of symlinks here. > > # But you can. make sure to set the right option. > > # > > Alias /adminmedia /var/www/html/adminmedia > > > > SetHandler None > > Order deny,allow > > Allow from all > > > > # this handles all my paster projects media files. > > # like /media for the main project. > > Alias /paster/media /var/www/html/pastebinmedia > > > > SetHandler None > > Order deny,allow > > Allow from all > > > > > > HTH > > Mike > > -- > > The closest to perfection a person ever comes is when he fills out a job > > application form. > >
Re: site styling works with development server but not apache
On Thursday, February 17, 2011 09:23:47 am you wrote: > I'm still having trouble. My directory structure is: > > /usr/local/www/static > > +- contrib/admin/media -- symlink to django/contrib/admin/media > > +- media/admin/base_site.html -- modified version of base_site.html > > I've tried every combination of the following, but nothing is working: > All you need here is the /usr/local/www/static any subdirectories here should be served as normal, like http://localhost/contrib/admin/media The admin template, You do not want it here. it should be in your template dir see the doc below this for that. http://docs.djangoproject.com/en/1.2/intro/tutorial02/#customize-the-admin- look-and-feel > DocumentRoot /usr/local/www/static > - does this need to be set at all? > No. > Alias /media/ /usr/loca/www/static/... > - not quite sure which directory this should point to > - I've tried all sensible options, but none work > Should be the absolute path to where you store your project media. > ADMIN_MEDIA_PREFIX = '/media/' > - Does this simply have to be equal to whatever URL is used in the Alias > directive above? > It needs to be another alias to the absolute path of the adminmedia. > Thank you. > Ok, this is a setup I have working (when the site/backend isn't broken ;)), This one is meant to work with nginx as a gateway serving my media and proxying back to my apache config, but it should work fine without nginx. This is also mod_wsgi specific, but you can add mod_python settings. Please read the comments, domain is the domain of this box. $USER is the username on the system. (these removed for security reasons). # basics for named based virtual hosts ServerName priss.domain.com ServerAlias domain.homelinux.org ServerAdmin webmas...@domain.com # this is the root url path. # I believe this can be omitted.. graham can verify or deny # either way it works as expected with this set ServerPath / # custom log paths. ErrorLog /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.error_log CustomLog /home/$USER/Server_Files/httpd/domain_com/apache/priss.domain.com.access_log combined # mod wsgi settings. # adjust threads per system. # wrap with the IfModule so I can also add mod_python directives # and let apache decide what to used based on the module loaded/used. WSGIDaemonProcess blog user=$USER group=$USER threads=100 WSGIDaemonProcess pastebin user=$USER group=$USER threads=100 # paster # this is a custom pastebin project that is served on a # subpath of the main url. this comes first before the main site # is served so that the main projects urls.py does not search # for this path # please note this is a completely different project served # as part of the main site. # (no control over subdomains on this box). # WSGIScriptAlias /paster /home/srv/$USER/web/projects/pastebin/apache/paster.wsgi # to make sure this runs in it's own interpretter. WSGIApplicationGroup pastebin Order deny,allow Allow from all # this is the main project/site served on the root of the urls path . WSGIScriptAlias / /home//srv/$USER/gufy/domain_com/apache/gm.wsgi WSGIApplicationGroup blog Order deny,allow Allow from all ### these are the parts you want. # /media serves all my main projects media. # these do not conflict with WSGIScriptAlias # Alias has a higher precedence than WSGIScriptAlias. # MEDIA_ROOT = /var/www/htm/media # Alias /media /var/www/html/media SetHandler None Order deny,allow Allow from all # this is the admin media. # ADMIN_MEDIA_URL = "/adminmedia/" # serves admin media for both projects. # /var/www/html/adminmedia is a copy of the django admin media found in # django/contrib/admin/media ... I'm not a fan of symlinks here. # But you can. make sure to set the right option. # Alias /adminmedia /var/www/html/adminmedia SetHandler None Order deny,allow Allow from all # this handles all my paster projects media files. # like /media for the main project. Alias /paster/media /var/www/html/pastebinmedia SetHandler None Order deny,allow Allow from all HTH Mike -- The closest to perfection a person ever comes is when he fills out a job application form. -- Stanley J. Randall -- You
Re: site styling works with development server but not apache
I'm using WSGI and tried your suggestion, but something is still missing. The generated HTML refers for example to a stylesheet href="/media/css/base.css". But this is in the django install directory, which is not being served. So I feel there has to be an Alias pointing there. Even if I did that, I'm confused about how I can overlay the modified base_site.html that the tutorial had us construct. My full VirtualHost configuration is: ServerAdmin user@foo Alias /media "/usr/local/www/static/media/" Order allow,deny Allow from all WSGIScriptAlias / /usr/local/www/scripts/sequme.wsgi ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Thanks for all the help! On Thu, Feb 17, 2011 at 12:44 PM, Marcos Moyanowrote: > This is the relevant VirtualHost configuration for admin media > > WSGI > Alias /media "/usr/local/www/static/media/" > > Order allow,deny > Allow from all > > > MOD_PYTHON > >SetHandler None > > > If this doesn't work perhaps you shoud could paste your VirtualHost > configuration. > > Rgds, > Marcos > > > > On Thu, Feb 17, 2011 at 2:23 PM, Ashish Agarwal wrote: > >> I'm still having trouble. My directory structure is: >> >> /usr/local/www/static >> | >> +- contrib/admin/media -- symlink to django/contrib/admin/media >> | >> +- media/admin/base_site.html -- modified version of base_site.html >> >> I've tried every combination of the following, but nothing is working: >> >> DocumentRoot /usr/local/www/static >> - does this need to be set at all? >> >> Alias /media/ /usr/loca/www/static/... >> - not quite sure which directory this should point to >> - I've tried all sensible options, but none work >> >> ADMIN_MEDIA_PREFIX = '/media/' >> - Does this simply have to be equal to whatever URL is used in the Alias >> directive above? >> >> Thank you. >> >> >> On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirez wrote: >> >>> On Thursday, February 17, 2011 07:14:16 am ashish wrote: >>> >>> > Hi all. I followed the tutorial to setup a basic django site and run >>> >>> > it with the development server. Everything looks fine. Then, I >>> >>> > configured to use apache. Everything seems to work except the styling. >>> >>> > The login and admin pages have no formatting. On IRC I was told the >>> >>> > issue is that the development server automatically serves the >>> >>> > necessary media, but that you have to explicitly configure apache to >>> >>> > serve static media. >>> >>> > >>> >>> > Okay, but which media needs to be served for the styling to work? I >>> >>> > have not found the answer in the docs. Thank you for any help. >>> >>> normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below >>> for the configuration settings (pick your production environment) >>> >>> http://docs.djangoproject.com/en/1.2/howto/deployment >>> >>> Mike >>> >>> -- >>> >>> If God had not given us sticky tape, it would have been necessary to >>> invent it. >>> >>> -- >>> 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 >>> django-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/django-users?hl=en. >>> >> >> -- >> 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 >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > > > -- > Some people, when confronted with a problem, think “I know, I'll use > regular expressions.” Now they have two problems. > > Jamie Zawinski, in comp.emacs.xemacs > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: site styling works with development server but not apache
This is the relevant VirtualHost configuration for admin media WSGI Alias /media "/usr/local/www/static/media/" Order allow,deny Allow from all MOD_PYTHON SetHandler None If this doesn't work perhaps you shoud could paste your VirtualHost configuration. Rgds, Marcos On Thu, Feb 17, 2011 at 2:23 PM, Ashish Agarwalwrote: > I'm still having trouble. My directory structure is: > > /usr/local/www/static > | > +- contrib/admin/media -- symlink to django/contrib/admin/media > | > +- media/admin/base_site.html -- modified version of base_site.html > > I've tried every combination of the following, but nothing is working: > > DocumentRoot /usr/local/www/static > - does this need to be set at all? > > Alias /media/ /usr/loca/www/static/... > - not quite sure which directory this should point to > - I've tried all sensible options, but none work > > ADMIN_MEDIA_PREFIX = '/media/' > - Does this simply have to be equal to whatever URL is used in the Alias > directive above? > > Thank you. > > > On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirez wrote: > >> On Thursday, February 17, 2011 07:14:16 am ashish wrote: >> >> > Hi all. I followed the tutorial to setup a basic django site and run >> >> > it with the development server. Everything looks fine. Then, I >> >> > configured to use apache. Everything seems to work except the styling. >> >> > The login and admin pages have no formatting. On IRC I was told the >> >> > issue is that the development server automatically serves the >> >> > necessary media, but that you have to explicitly configure apache to >> >> > serve static media. >> >> > >> >> > Okay, but which media needs to be served for the styling to work? I >> >> > have not found the answer in the docs. Thank you for any help. >> >> normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below >> for the configuration settings (pick your production environment) >> >> http://docs.djangoproject.com/en/1.2/howto/deployment >> >> Mike >> >> -- >> >> If God had not given us sticky tape, it would have been necessary to >> invent it. >> >> -- >> 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 >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. Jamie Zawinski, in comp.emacs.xemacs -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: site styling works with development server but not apache
I'm still having trouble. My directory structure is: /usr/local/www/static | +- contrib/admin/media -- symlink to django/contrib/admin/media | +- media/admin/base_site.html -- modified version of base_site.html I've tried every combination of the following, but nothing is working: DocumentRoot /usr/local/www/static - does this need to be set at all? Alias /media/ /usr/loca/www/static/... - not quite sure which directory this should point to - I've tried all sensible options, but none work ADMIN_MEDIA_PREFIX = '/media/' - Does this simply have to be equal to whatever URL is used in the Alias directive above? Thank you. On Thu, Feb 17, 2011 at 10:30 AM, Mike Ramirezwrote: > On Thursday, February 17, 2011 07:14:16 am ashish wrote: > > > Hi all. I followed the tutorial to setup a basic django site and run > > > it with the development server. Everything looks fine. Then, I > > > configured to use apache. Everything seems to work except the styling. > > > The login and admin pages have no formatting. On IRC I was told the > > > issue is that the development server automatically serves the > > > necessary media, but that you have to explicitly configure apache to > > > serve static media. > > > > > > Okay, but which media needs to be served for the styling to work? I > > > have not found the answer in the docs. Thank you for any help. > > normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below > for the configuration settings (pick your production environment) > > http://docs.djangoproject.com/en/1.2/howto/deployment > > Mike > > -- > > If God had not given us sticky tape, it would have been necessary to invent > it. > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: site styling works with development server but not apache
On Thursday, February 17, 2011 07:14:16 am ashish wrote: > Hi all. I followed the tutorial to setup a basic django site and run > it with the development server. Everything looks fine. Then, I > configured to use apache. Everything seems to work except the styling. > The login and admin pages have no formatting. On IRC I was told the > issue is that the development server automatically serves the > necessary media, but that you have to explicitly configure apache to > serve static media. > > Okay, but which media needs to be served for the styling to work? I > have not found the answer in the docs. Thank you for any help. normally the path assigned to MEDIA_ROOT and ADMIN_MEDIA ... see below for the configuration settings (pick your production environment) http://docs.djangoproject.com/en/1.2/howto/deployment Mike -- If God had not given us sticky tape, it would have been necessary to invent it. -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: site styling works with development server but not apache
On Thu, Feb 17, 2011 at 3:14 PM, ashishwrote: > Hi all. I followed the tutorial to setup a basic django site and run > it with the development server. Everything looks fine. Then, I > configured to use apache. Everything seems to work except the styling. > The login and admin pages have no formatting. On IRC I was told the > issue is that the development server automatically serves the > necessary media, but that you have to explicitly configure apache to > serve static media. > > Okay, but which media needs to be served for the styling to work? I > have not found the answer in the docs. Thank you for any help. > http://docs.djangoproject.com/en/1.2/howto/deployment/modpython/#serving-the-admin-files Cheers Tom -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.