How to see the common runserver log from django in heroku? - django

I am running a Django app on Heroku, and I am getting an error that I am not getting on my local machine. I am getting a 500 error. Normally, I just see the log Django outputs on the CMD, but I can't see it in Heroku. How can I do this?
BTW, it is not a dependency cause I just pip freeze > requirements.txt.
I am not looking for the logs that appear with heroku logs —tail since these logs only show the heroku output. I am looking for the same logs that appear locally. Is this possible?
Thanks!

Go to the directory you connected the project to the heroku,
use the command,
heroku logs --tail
sometimes you might be asked to login to your heroku account.. if so use the
heroku login
complete the login process and try again

Related

How can I connect to the same github repository for heroku and Ditigitalocean?

Is it possible to do that connection???
I have a project which I want to run on heroku at the same time on Digitalocean.
I tried it but heroku returns an error if I remove the Procfile, which Digitalocean does not require.
DO works if I remove the Procfile but heroku errors, and vieversa.

How to launch an instance of my Flask app on Heroku

I am having a hard time deploying my little flask app to Heroku. I created it in visual studio community and just want to deploy it now to Heroku.
App code:
https://github.com/Phasor/QR-Site-2020
I signed up for a free account at Heroku and am following this guide: https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app
I ran the following commands in their CLI:
git clone https://github.com/heroku/QR-Site-2020.git
heroku create
git push heroku master
When I write heroku ps:scale web=1 I get the following error:
Couldn't find that process type (web).
Looking for advice online it seems I need to define something called a Procfile. I have tried to do that and defined it as:
web: gunicorn runserver:app although I am very unsure that is correct (I normally just hit the "play" button in VS to run the app locally). Adding the Procfile does not solve the error message. I believe it should not hav the .txt extension but not sure you can create a text file without that in VS.
Originally I was not using gunicorn but think I may need to use that for Heroku so I added that to my requirements.txt.
Can anyone give me any pointers? Thanks

Heroku app with Django and postgres crashing unexpectdly

I am new to Django development, but I am in a situation where I need to deploy a large project on Heroku.
I ran my app in local system, it worked fine.
I pushed the same to Heroku and it also worked fine. But after few hours I open my app URL in browser , then app is saying Some thing has broken,intimated to admin.
The app worked fine before few hours, but what happened after few hours.
I just pushed my old DB backup to Heroku DB, Thats it app running fine now.
But I confused what happened to my app, I am facing this problem again and again,
how can I avoid this problem in future.
My app configuration:
psycopg2==2.4.5
Django==1.4
This could be a number of causes. It sounds more like a database issue. I would run the following command
heroku pg # TAKE NOTE OF THE HEROKU_POSTGRESQL_[COLOR]_URL
heroku pg:reset HEROKU_POSTGRESQL_[COLOR]_URL --confirm [appname]
This will reset your postgres database that is the active one, remove all tables etc.
Then I would run the regular command to get your database backup and running.
manage.py syncdb
You can also do the following
manage.py validate
This will go through your modules and tell you if any errors are present.
If that fails - enable debug in your settings.py file.
Also you can run "heroku logs" this will tell you the last few errors and statuses that have been hit with your app.
Let me know if this works, if not I will help debug further.

Django + GAE + Google Cloud SQL authentication issue in Windows

I've followed all steps required to configure Django with GAE + Google Cloud SQL (on Windows 7) but I am unable to authenticate (OAuth2) and run syncdb remotely. When I run manage.py syncdb the browser pops up and I am requested to allow access, but when I do that nothing happens. The browser is forwarded correctly to my local django instalation (the typical It worked! screen) but no OAuth2 token is in %USERPROFILE%\ and the console gets frozen:
C:\Users\me\myproject>python manage.py syncdb
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?state=None&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=my_id.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fsqlservice&access_type=offline
If your browser is on a different machine then exit and re-run this
application with the command-line parameter
--noauth_local_webserver
There is no error message and I have to kill the console.
Anybody has faced a similar issue? Is there any log somewhere in GAE I can check?
I had the same problem, only on OS X.
I never figured out why, but it went away after a reboot.
I had the same issue, but it was because I had local appengine server running while I was running manage.py syncdb. Shutting it down and trying again worked as intended.
hope that helps.

Deploying django project on AWS elastic beanstalk

I am following the tutorial for deploying a django project on AWS elastic beanstalk here:
http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/create_deploy_Python_django.html
My app works when I test locally but when I deploy, I'm getting a 404 error. Looking at the event logs, I see this message:
Error running user's commands : An error occurred running '. /opt/python/ondeck/env && PYTHONPATH=/opt/python/ondeck/app: django-admin.py syncdb --noinput' (rc: 127) /bin/sh: django-admin.py: command not found
That leads me to believe that the tutorial is missing a part about installing django files on the server or at least configuring my project to recognize django-admin.py. I have django installed on my local machine so it works there.
I know python support is brand new for elastic beanstalk but has anyone deployed django to it?
I believe you don't need to put container_commands in .config because there is no database or table at this moment.
Did you made the step?: Freeze the requirements.txt file.
(djangodev)# pip freeze > requirements.txt
Note
Make sure your requirements.txt file contains the following:
Django==1.4.1
MySQL-python==1.2.3
I had the same problem because I skipped it. Once I did it, add, commit and push. It works!
I followed the same tutorial recently and had a similar result.
At step 6, upon seeing the default django 'congrats' page render locally, I deployed to EB as instructed and got a 404 instead of the default 'congrats' page.
I decided to use the code up to that point as a foundation for following the 'getting started with django tutorial' which led me to a successful rendering of a 'home' view. This is a much more useful place to be anyway. I do agree that there is something wrong with the AWS tutorial and posted to the AWS forums here.
If you can, you should try to access the log file; it might give you a better idea of what's going on. Here's a link that might help:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.loggingS3.title.html