Deploying django project on AWS elastic beanstalk - django

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

Related

Trouble deploying django webapp onto google cloud

I've been following the google cloud documentation titled, "Running Django on the App Engine standard environment" . I'm using the same app provided in the documentation in the "Cloning the Django App". Honestly, I get lost in the google cloud documentation under the "Configuring Database Settings" section. This what my settings.py (mysite/settings.py in the given app mentioned previously)
Mysite/settings.py img
Whenever running python manage.py makemigrations - I get the following error message on the CLI...
django.core.exceptions.ImproperlyConfigured: Set the SECRET_KEY environment variable
Also, I have noticed there is no .env file in that repo. Would I maybe have to create it myself or would is it fine? Again I am using the github given app via the documentation.
Just trying to deploy Django website to google cloud. Any help would be greatly appreciated. Im on Mac Big Sur btw if that matters.
I tried to deploy the application using this documentation and got the same error you mentioned about. Then I observed that there is some issue with the github files mentioned in the documentation for which an open github issue is there. The reason for the issue is that the current code in the github repository matches a new tutorial version and we hope to get the new tutorial version updated soon to match the current code in the github repository.
For now using a specific previous version of ‘mysite/settings.py’ file in place of the current ‘mysite/settings.py’ file and adding ‘PyMySQL==1.0.2’ in requirements.txt file will work. The required previous version of the ‘mysite/settings.py’ can be found in this link. Follow the documentation for all remaining steps.

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

Django-Heroku Deployment Procfile

I've created a basic Django app and I wanted to deploy it with Heroku. I have followed all the instructions given on Heroku but there was one error I made which was naming the file "procfile" instead of "Procfile". Now the website has been deployed but it only opens up to an application error. Upon checking the log, I have found the error code to be H14. I have since renamed the "procfile" to "Procfile" but the change doesnt seem to be integrated. How do I fix this?
Add the change on your repository, commit it, and push the applicable branch to Heroku. Finally, try to run Heroku again.

installing GeoDjango on Heroku

I am trying to build a webapp which uses GeoDjango. The app is to be hosted on Heroku, but I am facing issues in it. I am using this buildpack but then this error is coming. Figured out that this is happening because of Cedar 14 but I am not clear as to what should I do next.
Also I tried using this buildpack but as discussed here, this issue can be resolved by using the buildpath as
$ heroku config:add BUILDPACK_URL=https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3
I tried the same but now it is not detecting it as a Python app and now I am facing the issue of "django import error - No module named core.management " missing, which is because its not installing Django.
Any help will be greatly appreciated.
I figured out the solution to this problem myself only.
To add multiple values for a BUILDPACK_URL, one needs to use a buildpack which can add support for mutiple BUILDPACK_URL.
So I used this. One can write like
$ heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
After this create a file .buildpacks and add to it the following
https://github.com/cyberdelia/heroku-geo-buildpack.git#e1b845b
https://github.com/heroku/heroku-buildpack-python.git
Note that #e1845b is because of this comment, which mentions that it is because of some caching issues.

django non-rel rollback

I cancelled a deployment to GAE while using django non-rel's manage.py deploy.
Now when I try to redeploy it says Another transaciton is already in progress and use appcfg to rollback.
But django non-rel doesn't have appcfg.py so how can I rollback or fix this issue?
I've scoured the internet and can't find any answers. I've waited about half an hour and it still displays this message.
manage.py deploy calls appcfg.py in order to deploy.
appcfg.py is in the SDK. you must have the SDK installed somewhere if "manage.py deploy" is working. you can look around for it, or download the SDK again.
There's no reason you don't have access to appcfg.py
If you need more help finding it, add details about what platform you're running on, where you installed the appengine SDK and where your python folder is.
What do you mean by "I don't have access to appcfg.py"?
Try going to cmd (for windows), navigate to your app directory, and type in the following:
appcfg.py rollback .
Hit return (enter key) and see if that works. If not, what does it display?