Committed a small code change to my django app and deployed to heroku. The app now throws H10 (app crashed) errors on every response. When I checked the logs, I saw..
[web.1]: Traceback (most recent call last):
[web.1]: File "nightlife2/manage.py", line 2, in <module>
[web.1]: from django.core.management import execute_manager
[web.1]: ImportError: No module named django.core.management
[web.1]: bash: bin/gunicorn_django: No such file or directory
..which I know means that django isn't on the pythonpath. I looked at the PATH on the heroku config which says bin:/usr/local/bin:/usr/bin:/bin. But while doing a heroku run bash, I noticed that the entire bin directory is now gone. Other apps of mine deployed on heroku can still be pushed to and still have the bin directory on there (I believe newer apps no longer have the bin directory and it's now in .heroku/venv/bin. Not 100% sure on the details there)
Has anyone ever encountered this? I can change the PATH to .heroku/venv/bin but then I get an error about sql and I don't know if this is closer or farther away from the root problem. ANYTHING would be greatly appreciated as this is the production server and is currently hosed.
EDIT: The error when changing the path is: django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3
. The database is postgress so I'm not sure where this is coming from
I resolved the issue. It was a combination of things. I'll document here and hopefully saves someone the headache I just experienced.
Our database had just been updated to the new Heroku Postgres dev plan. (Unsure if this is related or not). This was the first push of code since the database had been updated.
A while back I remember hearing about settings injections being deprecated. Being naive, we did nothing about it and never saw any changes so never followed up about it. They decided to take effect today and broke the linking to our postgres database. I'm still unsure as to why the bin directory is now gone, but it appears that the app is now using the new .heroku/venv/bin. To fix all of this, I had to change the settings.py to use the new postgres declaration for the database. I was correct in my OP that the PATH variable in the heroku config needed to be updated to point to the .heroku/venv/bin directory. I then had to update the Procfile because it was complaining about bin/gunicorn_django not being found. Once everything was updated, pushing the code solved the issue
Related
When I run my app locally, everything works, but when I try to deploy to Heroku, I get this error:
ModuleNotFoundError: No module named 'stripe'
I've read some other answers to similar issues and it seems like maybe my virtual environment is running a different version of Python than the one on Heroku, or something along those lines?
My Python version is 3.6.5
I do have a runtime.txt file with the following in it, which I thought was setting the python version for my Heroku app:
python-3.6.5
I read this SO thread, but I didn't really understand the part about the PYTHONPATH - Importing Stripe into Django - NameError
If anyone can help steer me in the right direction or has an idea of what I could try, I'd really appreciate it!
Thanks!
Add stripe to requirements.txt file in the root of your repository. You can read more about it here.
I'm deploying my Python app on GAE using the command line interface, which has always worked without problems. Since yesterday, one of the modules is getting stuck on "Scanning 500 files" and in the end throws following error:
Another transaction by user jong.vincent is already in progress for app: s~replimeapp, version: uno. That user can undo the transaction with "appcfg rollback".
However when I rollback updates for this app, the error is still thrown on the next deployment. No clue what I can do to resolve this. There is another module which refers to the same files, which has no problem deploying. No clue what I can do to get rid of this. Help please!
Changed the name of the module and then it worked. Very strange, but at least the problem is solved.
I am using satchless app in my local server. It is installed at python path.
Later i have create my project in my home directory and modify the settings.py file as described in this doc
But when i am running my server and goes to localserver localhost:8000 it gives me the error cannot import name cart_app I think it does not imort none of the app (cart, product or anything i have mention in my doc).
My url.py file is similar as it is specified in the doc i have mentioned above.
So any one who have used satchless app can tell me where i am wrong
Any suggestions would be appreciated
Thanks
Try to runserver --traceback, sometimes the error comes from somewhere else.
I am just starting to use Python GAE in Windows 7.
Based on my observations, it seems like changes that I make to the python scripts in my
local app engine directory do not show up when I launch the code to my 'localhost:XXXX' sandbox.
For example, I'll import one of my scripts and invoke some functions, and I get the error below.
The weird thing about this error is that the 'exec()' call is no longer at line 99 in the copy of 'main.py' that I have been revising.
Traceback (most recent call last):
File "/base/data/home/apps/[app name]/1.354953192642593048/main.py", line 99, in post
exec(cmd, safe_globals)
File "<string>", line 5, in <module>
NameError: name 'myFunction' is not defined
I guess my questions are:
1) What/where is '/base/data/home/apps/[app name]/1.354953192642593048/main.py'? Is this where they compile and run everything?
2) How can I 'rebuild' the local copy of my app folder such that the revisions I make are reflected in the sandbox?
Sorry for this relatively vague question. If somebody could explain how the sandbox is setup so I can figure out how to properly do debugging I would appreciate it.
UPDATE:
Never figured out how / why this error occurred. The output from that app engine directory was totally static no matter what kind of changes I tried to make, so I just deleted the folder and opened a new one. With this new folder (same exact contents, including app.yaml and main.py), I can make changes on the fly and my local debugger reflects those changes.
No longer a pressing issue, but if anybody has an idea as to how / why this error was occuring, I would be interested to hear it. As suggested in the comments below, the path provided in the error message is highly indicative of the workings of some remote base/ directory, even though I have been running everything on my localhost:[Port#] without any app deployment.
Are you sure you're running it locally? The traceback looks like it's from the app server. The '/base/data/home/apps/[app name]/1.354953192642593048/main.py' looks like the path to your application on Google's app server, not a Windows file path.
I've been developing on my laptop.
Now, I've uploaded my development project from Django 1.2/Python 2.7 up to Dreamhost created using the Passenger setup. I am using South for migration.
I modified settings.py to access MySQL. Got Admin working.
Questions:
1) Where is the std out shown when you hit the site? (all my print statements)
2) I had to add
from decimal import Decimal
to get the settings.py to run.
Now, hitting the server gives me a 500. When I go to the commandline and try any manage.py command I'm getting:
Error: Could not import settings 'pholdershare.settings' (Is it on sys.path? Does it have syntax errors?): No module named settings
I modified the permissions for my folder to 755 but that didn't change anything.
3) Regarding development to testing to live, I'm totally unclear on how to do this. I want to have a nice solid system for development where I can do releases but I've never done that. I have been using GIT locally. Can anybody point me to the tutorial on setting up the release system?
Suggestions?
Thanks much!
"Could not import settings 'pholdershare.settings'"
...usually means either settings.py has an import error or syntax error, or pholdershare has not been added to sys.path in your wsgi.py