PostgreSQL for Django on Elastic Beanstalk - python

I'm reading conflicting reports about using PostgreSQL on Amazon's Elastic Beanstalk for python (Django).
Some sources say it isn't possible: (http://www.forbes.com/sites/netapp/2012/08/20/amazon-cloud-elastic-beanstalk-paas-python/). I've been through a dummy app setup, and it does seem that MySQL is the only option (amongst other ones that aren't Postgres).
However, I've found fragments around the place mentioning that it is possible - even if they're very light on detail.
I need to know the following:
Is it possible to run a PostgreSQL database with a Django app on Elastic Beanstalk?
If it's possible, is it worth the trouble?
If it's possible, how would you set it up?

Postgre is now selectable from the AWS RDS configurations. Validated through Elastic Beanstalk application setup 2014-01-27.

Is it possible to run a PostgreSQL database with a Django app on
Elastic Beanstalk?
Yes. The dummy app setup you mention refers to the use of an Amazon Relational Database Service. At the moment PostgreSQL is not available as an Amazon RDS, but you can configure your beanstalk AMI to act as a local PostgreSQL server or set up your own PostgreSQL RDS.
If it's possible, is it worth the trouble?
This is really a question about whether it is worth using an RDS or going it alone, which boils down to questions of cost, effort, usage, required efficiency etc. It is very simple to switch database engines serving django so if you change your mind it is easy to switch set up.
If it's possible, how would you set it up?
Essentially you need to customise your beanstalk AMI by installing a PostgreSQL database server on an Amazon linux EB backed AMI instance.
Advice / instructions regarding customising beanstalk AMIs are here:
http://blog.jetztgrad.net/2011/02/how-to-customize-an-amazon-elastic-beanstalk-instance/
https://forums.aws.amazon.com/thread.jspa?messageID=219630&#219630
Customizing an Elastic Beanstalk AMI

Related

heroku run python manage.py migrate do not create table on heroku server [duplicate]

I want to deploy an application with sqlite3 as the database on Heroku. However, it seems to be that Heroku doesn't support applications with sqlite3 as the database. Is it true? Is there no way to deploy my sqlite3-backed application on Heroku?
PS: I have successfully deployed my application using PythonAnywhere, but would now like to know whether there's any possible way to deploy it using Heroku.
As Heroku's dynos don't have a filesystem that persists across deploys, a file-based database like SQLite3 isn't going to be suitable. It's a great DB for development/quick prototypes, though.
Heroku do have a Postgres offering however that will suit - with a free tier and a basic $9/month tier that are good for hobby/small projects. The biggest benefit over SQLite is that you get backups that you wouldn't get otherwise (plus all the other Postgres features).
There's a guide to updating your settings.py to use Postgres here: https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
Heroku has a detailed article explaining "Why is SQLite a bad fit for running on Heroku" https://devcenter.heroku.com/articles/sqlite3

How to upload local mysql database to heroku app?

I have a web application written in Python-Flask with database created using MySQL. I have deployed my app using Heroku but it's only the frontend and backend part. I also need to upload database so that the app can interact with the database. I have searched many videos on YouTube but nothing came as useful. Most of them are using Postgre SQL both in local and heroku app but I've an MySQL database with me. I need help how can I connect my app to my database.
Heroku has native support for postgessql not mysql, so you might want to change to that or use the Clear DB addon as explained in the docs.
From heroku
"Heroku provides three managed data services to all customers:
Heroku Postgres, Heroku Redis, Apache Kafka on Heroku"
Also have a look at this previous answer that targets the same issue.

Django: Deploying an application on Heroku with sqlite3 as the database

I want to deploy an application with sqlite3 as the database on Heroku. However, it seems to be that Heroku doesn't support applications with sqlite3 as the database. Is it true? Is there no way to deploy my sqlite3-backed application on Heroku?
PS: I have successfully deployed my application using PythonAnywhere, but would now like to know whether there's any possible way to deploy it using Heroku.
As Heroku's dynos don't have a filesystem that persists across deploys, a file-based database like SQLite3 isn't going to be suitable. It's a great DB for development/quick prototypes, though.
Heroku do have a Postgres offering however that will suit - with a free tier and a basic $9/month tier that are good for hobby/small projects. The biggest benefit over SQLite is that you get backups that you wouldn't get otherwise (plus all the other Postgres features).
There's a guide to updating your settings.py to use Postgres here: https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
Heroku has a detailed article explaining "Why is SQLite a bad fit for running on Heroku" https://devcenter.heroku.com/articles/sqlite3

Deploying Django Application

So I am quite the beginner in the world of web development. I have been working on a django application, and now that my application is running pretty well I am staring into the face of the monster that is deployment, and wondering which direction to take.
My application is running Django 1.7 and Python 3.4. I want to use PostgreSQL with Postgis as my database. I was originally thinking of using Amazon AWS for deployment, using their Elastic Beanstalk PaaS service, although now I am wondering if something like Heroku may be better for me as a beginner to all of this. I need my application to scale easily, without me having to dive into too much configuration that I am very likely to mess up.
What I am wondering is which service would be best for a newcomer developer deploying an application running the platforms I mentioned above. Heroku seems like it is a bit easier to use than AWS, but I am concerned that the pricing with Heroku would ramp up more quickly than with AWS. How difficult would it be to initially deploy using one service and migrate to another as I become more familiar with the process of maintaining web applications and/or as my needs change?
Any recommendations or info to help me decide on a service to go with would be very much appreciated.
Can I plug the company I work for, PythonAnywhere? Making Python application deployment easy is pretty much what we're there for :-)
Postgres support (including PosGIS) is currently in beta, but is pretty solid -- if you sign up, just drop us a line and we can enable it for your account.
Deploying Django service using postgres at AWS is as easy as you use local server, AWS is easy and good to use, you just need to confgiure confuguration file of Postgres and server you install at AWS. go to this https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn if you are using Apache.

Deploying Pyramid application on AWS EC2

I have been given a task to complete: Deploy my pre-existing Pyramid application onto our EC2 Linux server. I would like to do this with a minimal amount of stress and error, especially considering am I totally new to AWS.
What I have done so far:
Setup the EC2 instance which I can SSH into.
Locally develop my Pyramid application
And, we version control the application with GitHub.
We are using: Pyramid (latest), along with Python 2.7.5 and Postgresql (via SQLAlchemy and Alembic.)
What is a basic, high-level list of steps to ensure that my application is deployed appropriately?
Where, if at all, does something like Elastic Beanstalk come into play?
And, considering my project is currently in a Git repo, what steps or considerations must be taken to accommodate this?
I'm not looking for opinions on how to tweak my setup or anything like that. I am looking for a non-debatable, comprehensible set of steps or considerations to deploy my application in the most basic form. This server is for development purposes only, so I am not looking for a full-blown solution.
I have researched this topic for Django projects, and frankly, I am a bit overwhelmed with the amount of different possible options. I am trying to boil this situation down to its minimal components.
I appreciate the time and help.
Deploying to an EC2 server is just like deploying to any other Linux server.
If you want to put it behind a load balancer, you can do which is fully documented.
You can also deploy to Elastic Beanstalk. Where as EC2 is a normal Linux sever, Beanstalk is more like deploying to an environment, you just push all your git changes into an S3 repo, your app then gets built and deployed onto beanstalk.
Meaning no server setups, no configuration (other than the very basics) and all new changes you push to S3, get built and update each version of your app that may have been launched on beanstalk.
You don't want to host your database server on EC2, use Amazons RDS database server, dead simple and takes about two minutes to setup and configure.
As far as file storage goes, move everything to S3.
EC2 and beanstalk should not be used for any form of storage.
I would suggest to run two instances and use Elastic Load Balancer.
Never run anything important on a single EC2 instance, EC2 instances are not durable, they can suddenly vanish, taking whatever data you had stored on it.
Everything else should work as in Pyramid Cookbook description.
Although there is no specific recipe for deploying a Pyramid application to AWS in the Pyramid Cookbook, there are other recipes that may offer a partial solution.

Categories