gunicorn modul not found django heroku - python

first time deploying to heroku. I got the test app deployed and I ran the migrations fine. However, I got the following error
ModuleNotFoundError: No module named 'djorg2'
I ran heroku logs --tail and got the following result here
here is the a pic of my file paths
and here is my current Procfile
web: gunicorn djorg2.wsgi --log-file -
I'm a little new to deploying on heroku. Does anyone know what my problem might be and/or count point me in the right direction. I been trying to trouble shoot this for the good part of an afternoon and I'm a little stuck.

web: gunicorn practice.djorg2.wsgi --log-file -

Thanks for the tips everyone. I had a feeling it was probably due to file placement. I re-organized my files so that everything was at the root of my git repo and it works fine now.
I think I'm going to put everything in its own file location from now on just to be more organized and not confuse myself. I did try
web: gunicorn practice.djorg2.wsgi --log-file -
but for some weird reason it didn't work.

Related

i am getting a 'Application Error' while hosting django project on heroku

recently i have tried to host my first django project on heroku, but i am getting the following error "An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail"
this is a link of my github repository...........https://github.com/derexes292/onlinetest..........
i have put the screenshot of error and logs in the 'error screenshot' folder
please help me, i have been working on this problem from a long time but i am not getting any solution.
I have deployed the git repo, your project's Procfile requires an update. You need to provide the correct project name instead of CCMS.wsgi -> onlinetest.wsgi,
web: gunicorn CCMS.wsgi --log-file -
to
web: gunicorn onlinetest.wsgi --log-file -
After changing Procfile deploy it again on Heroku. I hope this will solve your problem

Error when running "heroku ps:scale web=1": "Couldn't find that process type (web)."

I am attempting to deploy a Heroku Dash app from PyCharm. After running the code to deploy it, I got Heroku error code "H14 - No web dynos running," the solution for which is supposed to be heroku ps:scale web=1. Here is the error I get when attempting to run that line:
Scaling dynos... !
▸ Couldn't find that process type (web).
Others with this problem have been advised to check their procfile. Mine is formatted correctly, with the name "Procfile." Within it is web: gunicorn main:server, where 'main' is the name of the Python file for my app. Any other suggestions about what I could be doing wrong?
The Procfile was created correctly but had not been committed before deployment.

Gunicorn ModuleNotFoundError

I'm reading a book about TDD and Django and there's a deployment part. I have a problem trying to run gunicorn with the following command:
/root/sites/django_blog/virtualenv/bin/gunicorn --bind unix:/tmp/django_blog.socket django_blog.wsgi:application
It fails with the following error:
ModuleNotFoundError: No module named 'django_blog'
But when I activate my virtualenv and instead of writing the full pass to gunicorn I just go with:
gunicorn --bind unix:/tmp/django_blog.socket django_blog.wsgi:application
And everything works perfectly! The problem is I still need to run it the first way, because I wil use it in the nginx service file. I wrote about this error and tried a couple of solutions but they didn't work for me. I guess I have to do something with environment variables but I don't know what exactly.
You can specify a directory to gunicorn to switch to before the apps are loaded.
Simply add --chdir /path/to/directory to the launch.
In your case this might look as follows:
/root/sites/django_blog/virtualenv/bin/gunicorn --chdir /root/sites/django_blog/source --bind unix:/tmp/django_blog.socket django_blog.wsgi:application
Here is the link to the specific gunicorn settings documentation.
Hope that helps and happy coding!

Newrelic error in Django : Configuration has already been done

I am getting this error when i am trying to run
python manage.py runserver for my Django Project,
newrelic.api.exceptions.ConfigurationError: Configuration has already been done against differing configuration file or environment. Prior configuration file used was "/home/project/newrelic.ini" and environment "staging".'
What does it mean ?? How to approach it?
Have you just setup New Relic?
I believe this is a problem with your procfile. Which you most likely just have edited.
Your procfile should look something like this, depending on your wsgi.
web: newrelic-admin run-program gunicorn hello.wsgi --log-file -

Django Heroku push failing

I'm running accross an error trying to push my Django project up to Heroku and I was looking to see if anyone had any insight.
! Heroku push rejected, no Cedar-supported app detected
I am guessing it is because of my folder structure in the git repo but I am not sure. My project is setup like this:
/subfolder/djangoproject/
/subfolder/requirements.txt
My Proc file content looks like this:
web: python manage.py runserver 0.0.0.0:$PORT --noreload --settings=djangoproject.settings.heroku
I have my project setting split and they work fine on my local. (In other words I having a setting directory with an init.py in it.)
I tried this:
/Procfile
and this:
/subfolder/Procfile
but neither worked.
Can this folder structure be the culprit? I was under the impression that the requirements.txt was how Heroku found where the project folder was.
Thanks
I wanted to add my solve for the first issue I had and then post the new issue I am having.
The solve I first did was to move the Procfile and requirements.txt files to the root level of the project. The second thing I did was edit the Procfile in so the path to the manage.py script was to the proper location
web: python subfolder/djangoproject/manage.py runserver 0.0.0.0:$PORT --noreload --settings=djangoproject.settings.heroku
I've hit a new error now when trying to run a syncdb. It seems to go through the process but nothing takes. In other words, if I run syncdb once and then run it a second time, it wants to set everything up all over again. Any thoughts on what I may have configures wrong to make the DB not save it's data? Should I use the setting for the DB from the dashboard or keep this line in the Django config:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
Thanks
You need requirements.txt or setup.py in the root of the repo.
See https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect

Categories