PyCharm does not find templates, nor template tags, nor static files in my Django project even though the project itself is set up right and working.
I am using Django 1.6.2
with this layout:
proj
.devtmp
manage.py
proj
settings.py
app1
templatetags
app2
templates
static
and with settings like these:
from os.path import join, dirname, pardir, abspath
PROJECT_ROOT = abspath(join(dirname(__file__), pardir))
DEV_TMP_DIR = join(PROJECT_ROOT, pardir, '.devtmp')
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
TEMPLATE_DIRS = (
join(PROJECT_ROOT, 'templates'),
)
MEDIA_ROOT = join(DEV_TMP_DIR, 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = join(DEV_TMP_DIR, 'static')
STATIC_URL = '/static/'
INSTALLED_APPS = (
...
'django.contrib.staticfiles',
...
'proj'
'proj.app1'
'app2'
)
Update:
In the IDE preferences, I have configured paths to the project root, settings.py
and manage.py
. In addition, I have configured the project interpreter (I am running the runserver from the IDE right now with no problems).
Please try this - it works for me for templates:
EDIT :
After a project structure reorganization I had problem with static files again. Setting destination of setting.py
file in Django Support -> Settings resolved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With