Reputation: 39059
I've developed a stand-alone Django app that has one static JS file. On some installations, Django development server can't find the static file. The app is installed as a Python Package with pip, and I can find the JS file in site-packages/appname/static/js/myfile.js
I've installed the Django Debug Toolbar, and when looking at the "static" panel, I see a list of "static file apps". My app is not listed there. How can I tell Django it should look at my app's static file folder, too?
I'm using Django 1.6.3, with the following static file finders:
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
The django.contrib.staticfiles
app is installed.
Update: When using manage.py collectstatic
, files from the app are not copied.
Upvotes: 0
Views: 605
Reputation: 39059
OK, this was stupid.
The app in question was previously part of the old project. I've changed it into an independent app on a different development machine. When I wrapped it as an independent app I deleted the myproject/myapp
folder on the other machine, and used pip install
to install it to the project's virtual env.
Then I used this development machine, did a git pull
and pip install
. Turns out this *doesn't delete the myproject/myapp
folder - it just deletes all the files handled by git. .pyc
files are not deleted, so the folder remained, and Django looked for static files in that folder, instead of the one in site-packages
.
Removing myproject/myapp
fixed this.
Upvotes: 1