Re: Unable to display static content.

2012-01-01 Thread Chirdeep
Now I have changed the project structure to

Project
-webApp
---static
-images
-stylesheets
-index.html
---templates

I can browse to index.html inside static folder.

http://127.0.0.1:8000/static/index.html

For some reason, its adding the search-form to the URL for loading CSS
and Images when I browse to http://127.0.0.1:8000/search-form/

Firebug shows :
http://127.0.0.1:8000/search-form/common.css

Obviously then it won't find the resources.


-- 
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.



Unable to display static content.

2011-12-30 Thread Chirdeep
Hi All,

I am just learning Python and Django. I am able to see the webpage but
css and images are not picked up.

Configuration as below:

Linux Ubuntu 11.04
Python 2.7.2
Django 1.3.1

I have setup Django using VirtualEnv. I am using PyCharm and my Django
project is pointing to the VirtualEnv Django installation.

In firebug, I am getting 404 for css and images.

Project Structure.

ProjectRoot
-media
   -images
   -stylesheets
-templates
-webapp

urls.py
--
from django.conf.urls.defaults import patterns, include, url
import settings
from talenthunt.web import views

urlpatterns = patterns('',
url(r'^search-form/$', views.search_form),
url(r'^search/$', views.search),
)

if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))


settings.py
---
def rel(*x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)),
*x )

MEDIA_ROOT = rel('media')
MEDIA_URL = '/media/'

STATIC_ROOT = rel('static')
STATIC_URL = '/static/'

ADMIN_MEDIA_PREFIX = '/media/admin/'

Only pasting relevant code from settings.py

Base.html
--


Organic Web Design



Any help will be much appreciated.

Thanks
Chirdeep



-- 
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.