Code Monkey home page Code Monkey logo

flask-aws-tutorial's Introduction

Deploying a Flask application in AWS: An end-to-end tutorial

This is the code that goes along with the detailed writeup here:

https://medium.com/@rodkey/deploying-a-flask-application-on-aws-a72daba6bb80

It's a simple Flask app that writes and reads from a database. It uses Amazon RDS for the database backend, but you can make things even simpler and use a local DB.

To tool around with the app directly, here's a quickstart guide.

Clone this repo to your local machine. In the top level directory, create a virtual environment:

$ virtualenv flask-aws
$ source flask-aws/bin/activate

Now install the required modules:

$ pip install -r requirements.txt

To play with the app right away, you can use a local database. Edit config.py by commenting out the AWS URL and uncomment this line:

SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'

Next run:

$ python db_create.py

And the tables are created. Now you can launch the app:

$ python application.py

And point your browser to http://0.0.0.0:5000

Using the top form, you can write to the database:

Site main page

Data entered

Get confirmation:

confirmaton

Using the bottom form, you can see the last 1 to 9 entires of the database in reverse chronological order:

results

flask-aws-tutorial's People

Contributors

inkjet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-aws-tutorial's Issues

Need to install boto

The only missing part is that I have to install boto using:
$ pip install boto
before doing:
$ eb start

Thanks for a great tutorial!

Db table not created

I added the following to config.py

import os
basedir = os.path.abspath(os.path.dirname(__file__))
# Uncomment the line below if you want to work with a local DB
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'data-dev.sqlite')

and run
$ python db_create.py

the database file is created but no table is created.

pip install failed

I have to change Flask-SQLAlchemy==2.0 to Flask-SQLAlchemy==1.0 to make pip install work

Question on WSGIPath

Hi,

I think the default WSGIPath is application.py for EB but I need to run:
$python manage.py runserver 0.0.0.0:80

Do you know how to configure EB to run that? Thanks a lot for your help!!

Harry

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.