Thursday, November 29, 2012

difficulty with static files

Hello django experts
I am unable to get my static files to work.  Here are my settings:

projectfiles
|
|-----myproject
|     |
|     |-----static
|     |     |
|     |     |-----css
|     |     |-----js
|     |-----__init__.py
|     |-----settings.py
|     |-----urls.py
|     |-----wsgi.py
|
|-----myapp
|
|-----templates


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


settings.py
import os
SITE_ROOT = (os.path.realpath(os.path.dirname(__file__))).replace('\\','/')
DEBUG = True
MEDIA_ROOT = (os.path.join(SITE_ROOT, '/static')).replace('\\','/')
MEDIA_URL = '/static/'
STATIC_ROOT = ''
STATIC_URL = ''
STATICFILES_DIRS = ()
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


urls.py
urlpatterns = patterns('',
    (r'^myurl/$', myview),
)


from myproject.settings import DEBUG
if DEBUG:
    urlpatterns += patterns('', (r'^static/(?P<path>.*)$', 'django.views.static.serve', 

{'document_root': 'static'}))
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

the app works fine but no connection to my css's or javascripts.

I'm using pycharm if that makes a difference.

Any help would be greatly appreciated.



 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kFq9WoTc9awJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment