Can't deploy Django on Heroku due to static error [duplicate] - django

This question already has answers here:
Heroku missing required flag: -a,
(11 answers)
Closed 1 year ago.
Hello I am trying to launch my django website on heroku. I downloaded the heroku CLI, and I am running the following code on fish to resolve the error:
heroku config:set DISABLE_COLLECTSTATIC=1
however I am getting the following error
› Error: Missing required flag:
› -a, --app APP app to run command against
› See more help with --help
Can someone please tell me how to resolve this issue?

The error is very clearly indicating you need to add -a or --app flag
Try running,
heroku config:set DISABLE_COLLECTSTATIC=1 -a YOUR_APP_NAME_HERE

Related

Heroku Application Error while Deploying Django application

enter image description here
Please help me with this error
It may be due to your static files.
Try the following:
heroku config:set DISABLE_COLLECTSTATIC=1
git push heroku main
heroku run python manage.py migrate
heroku run 'bower install --config.interactive=false;grunt
prep;python
manage.py collectstatic --noinput'
heroku config:unset DISABLE_COLLECTSTATIC
heroku run python manage.py collectstatic
Hope this helps.
I can also see the console says: could not find module 'whitenoise'. Have you set your requirements.txt properly?

Error on Deployment Django App with Heroku

I know there is already a Topic of Desployment on Heroku with Django but it didn´t help me.
I have following error:
! Error while running '$ python markb/manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed
Disable collectstatic using below command:
set DISABLE_COLLECTSTATIC=1
And then try.

"Error: Couldn't find that app. › › Error ID: not_found." when running heroku commands in console

Heroku sees my app in the list of apps, but I can't access it with any commands. I constantly getting the error "Couldn't find that app". I tried all these:
heroku run python manage.py migrate --app app-generator
heroku run python manage.py migrate
heroku run python manage.py createsuperuser --app app-generator
Although when I try to run commands for 'heroku apps' in my console, says I have one app called my-api. I followed other similar questions and tried the git remote commands beforehand but still failed. Example:
heroku apps
heroku git:remote -app app-generator
If it's another user's heroku project. Then you need to use "... -a name" where name should be name of the team, not the name of the app. Login to heroku and find the team name from the dropdown.And run commands again.

ImportError when using heroku for my django web

I checked django is installed properly and in my 'requirements.txt' I wrote 'Django==3.2.3'. However, I cannot use this code:
heroku run python manage.py migrate
So I checked this code:
python manage.py migrate
and found out it worked properly. I know that there are existing questions and read many of them, but I think I have tried everything I could do. I would be really grateful if someone can solve this problem.
your question isn't clear tbh.
install all the dependencies by using the pip freeze command and try to run your heroku commands in the heroku bash available in your heroku dashboard
to run the commands on your heroku machine from your CMD, then command is
heroku run bash --app your_app_name
then you can run whatever command you want.
but I am not sure what is the exact problem you are having.

Unknown command: 'run_gunicorn' with Django, Heroku, and New Relic

I am installing an add-on named New Relic (monitoring) on my Django Heroku app, following this doc.
After installaling the new relic agent, I was asked to change the Procfile to:
web: newrelic-admin run-program python manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3
I dit it.
When starting the app on Heroku, I can see in heroku logs that it's crashed because of a Unknown command: 'run_gunicorn' error.
Indeed, typing heroku run python manage.py help let me see that the command does not exist.
What's going on?
here is an extract of heroku run pip freeze:
Django==1.7.6
gunicorn==19.1.1
newrelic==2.46.0.37