STATIC_ROOT vs STATIC_URL in Django

STATIC_ROOT The absolute path to the directory where ./manage.py collectstatic will collect static files for deployment. Example: STATIC_ROOT=”/var/www/example.com/static/” now the command ./manage.py collectstatic will copy all the static files(ie in static folder in your apps, static files in all paths) to the directory /var/www/example.com/static/. now you only need to serve this directory on apache or … Read more

django static files versioning

Django 1.4 now includes CachedStaticFilesStorage which does exactly what you need (well… almost). Since Django 2.2 ManifestStaticFilesStorage should be used instead of CachedStaticFilesStorage. You use it with the manage.py collectstatic task. All static files are collected from your applications, as usual, but this storage manager also creates a copy of each file with the MD5 … Read more

Heroku & Django: “OSError: No such file or directory: ‘/app/{myappname}/static'”

It’s looking for a folder named ‘static’ that’s next to the settings.py, i.e. in the project folder, not at the root of the git repo. git root/ git root/{app name} git root/{app name}/settings.py git root/{app name}/static/ <- this is what you’re missing Note that empty folders aren’t tracked by git, so you’ll have to put … Read more

Python Django: You’re using the staticfiles app without having set the STATIC_ROOT setting

What is the production.py file? How do you import your settings? Depending on how you got this error (serving django through a wsgi server or on the command line), check for manage.py or wsgi.py to see what is the name of the default settings file. If you want to manuallly set the settings to use, … Read more

Can I make STATICFILES_DIR same as STATIC_ROOT in Django 1.3?

No. In fact, the file django/contrib/staticfiles/finders.py even checks for this and raises an ImproperlyConfigured exception when you do so: “The STATICFILES_DIRS setting should not contain the STATIC_ROOT setting” The STATICFILES_DIRS can contain other directories (not necessarily app directories) with static files and these static files will be collected into your STATIC_ROOT when you run collectstatic. … Read more

Django serve static index.html with view at ‘/’ url

You can serve static/index.html for development like this: if settings.DEBUG: urlpatterns += url( r’^$’, ‘django.contrib.staticfiles.views.serve’, kwargs={ ‘path’: ‘index.html’, ‘document_root’: settings.STATIC_ROOT}), But for production you should configure your nginx (or other frontend server) to serve index.html file for / location UPDATE I want to explain the case you should do like this. For example your django … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)