python - Managing URLs in a Django site inside a folder -
so have django project in folder on server, so:
www.mydomain.com/myfolder/
the index page loads, things css document don't because paths improper. missing shortcut? looked through settings.py documentation place specify site folder, didn't find help.
so example, if specify in settings:
static_url = 'static/' then css doc on /myfolder/login page at:
http://mydomain.com/myfolder/login/static/stylesheet.css if specify:
static_url = '/static/' then css doc on /myfolder/login page at:
http://mydomain.com/static/stylesheet.css meanwhile, css document at:
http://mydomain.com/myfolder/static/stylesheet.css do need change , specify /myfolder/ before everything?
i think need add path of static_root in settings, , update urls.py file.
my example:
#settings.py .... static_url = '/static/' static_root = os.path.join(os.path.dirname(base_dir), "static",) #path static folder #urls.py ... django.conf import settings django.conf.urls.static import static .... urlpatterns += static(settings.static_url, document_root=settings.static_root)
Comments
Post a Comment