-
Notifications
You must be signed in to change notification settings - Fork 71
Cannot make it work with DEBUG=False on Heroku #11
Comments
Are you using the latest release? |
I'm using the one available on pip: dj-static==0.0.5 |
@filipeximenes |
Yes. |
Not sure if i made some mistake or just got confused, but Forman is working perfectly with: STATIC_ROOT = 'staticfiles' I still can't get Heroku to serve my staticfiles. |
Also, when I run collectstatic, files are being saved at the root directory (not the "django project root")
(this is the configuration Foreman works) |
I changed the whole project to a more traditional structure:
Still getting the same result. It works with forman but not in heroku. I destroyed my previous application in heroku and started another with no success. |
This does not sound like a problem with dj-static (or static), it seems more this is your app not fully working on heroku :) When Heroku does not run collectstatic on push, the static files are missing. |
Well, I really don't know where is the problem. I just made it work putting collectstatic inside Procfile: |
I've the same problem. Maybe there's something wrong with --pythonpath project? (I'm just guessing). I've even tried to run collect static after a push but nothing changed, the file were copied but when I try to access a static file I get a 404 error. @filipeximenes solution partially worked for me I can see my assets but admin assets are missing. I'm going to create a ticket on heroku support site. |
Also running into this issue. Strange. |
FYI this is the reply I received from Heroku support
|
I have tried the "traditional" project layout with no success (see previous messages). Also, just yesterday a friend of mine came to me (after finding this discussion) and told me he had the same problem, I've checked and he had manage.py in the root of his repository. |
@filipeximenes I'll do as soon as possible :) |
+1 We're seeing this only work with "DEBUG = True" as well. |
Just chiming in as getting this error as well. |
Same problem (manage.py in root). The only workaround that works for me is running collectstatic locally and adding generated staticfiles directory to git, before pushing to heroku. |
I'm also having the same problem, and the manage script is in the root of the repo. |
I'm having the same problem, manage.py is in the root of my repo, and
The problem occurs both on Heroku and locally using honcho (a python foreman clone) |
Mee too had this problem, i solved it. Just try in settings.py
then add
Then in urls.py add
|
The problem with that solution is that then my site would still have a debug setting on. Plus, according to https://docs.djangoproject.com/en/1.6/howto/static-files/ regarding django.views.static.serve
|
I had this issue - Turns out I was doing the dry run passing in a settings file, and was grabbing a default value in the wsgi file. Since the collect static runs outside wsgi, it didn't have a settings file associated, but the collect static run in a separate worker worked fine. |
I found the cause. I turned on config variable |
@hktonylee in my case I don't have this variable set on heroku
|
For anyone having this issue it would help a lot if you could setup a vanilla Django project with the bare minimum configuration to reproduce the error, thanks! |
Had the same problem. Solved it by setting |
@rahmonov I do |
I tried this approach
but in heroku it does not work, only static
|
Is this issue still not fixed? I'm having the same problem. Only debug=true let the website runs, when I turn it off, it can't read the staticfiles. |
need help, the same problem here |
Me two. Also my uploaded profile images disappear after a while |
Make sure to check the wsgi.py that it loads that correct DJANGO_SETTINGS_MODULE |
I was having the same issues. With debug=True both the vs Code/Python/Django web app and Heroku web app worked. With debug=False, neither of them worked. |
I had this same issue, realized whitenoise was causing the issue. So I just set STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' instead of STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage', and everything worked fine. |
I tried every single suggestion in this forum till now and none did it |
I deployed to Heroku months ago just to see if I could take a simple blog to the next level. I'll share the links I used to solve many of my problems I had with deploying. I read in my log notes that I needed to change my code to use PostGreSQL instead of sqlite3. I also noted an issue I had were I didn't migrate my code changes. |
what is |
you can using nginx then set location for it |
oh okay after months of failing and errors luckily I found out that it was like the most stupidest mistake ever I wrote something like /images instead of /static/images in the static root and magically it worked |
I'm trying to serve statics on heroku with DEBUG=False. When DEBUG is True everything works perfectly so it is when I run my application locally with Heroku's Foreman. Collectstatic runs with no problems in both ambients.
Forman works with the following setting:
STATIC_ROOT = root('staticfiles')
STATIC_URL = '/static/'
But i've tried setting it with:
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
with no success.
My app is structured in the following way:
I'm setting --pythonpath to the project folder in the procfile.
The text was updated successfully, but these errors were encountered: