Simple URL Shortener with Flask and SQLAlchemy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
static/css
templates
.gitignore
README.md
models.py
requirements.txt
shortner.py
tests.py
utils.py

README.md

Flask Shortner

A simple URL Shortner built with Flask, SQLAlchemy, PostgresSQL, PureCSS, and some other fabulous goods found on the internets.

Screenshot

Getting Started

To install FlaskShortnere:

  • Create a virtualenv and install requirements.txt

      pip install -r requirements.txt
    
  • Clone this repo somewhere

      git clone https://github.com/beshrkayali/flaskshort.git
    
  • Create a new postgres user role named 'flask' with password '123321'

      createuser -U postgres flask -P
      Shall the new role be a superuser? (y/n) n
      Shall the new role be allowed to create databases (y/n) y
      Shall the new role be allowed to create more new roles? (y/n) n
    
  • Create a new db named flaskshort

      createdb -U flask -E utf8 -O flask flaskshort -T template0
    
  • Crete DB structure:

      cd /into/project/dir
      python
    
      >>> from models import db
      >>> db.create_all()
    
  • Run app:

      python shortner.py
    
  • Enjoy!

Note

You can change SQLALCHEMY_DATABASE_URI to better suit your setup, found in models.py.

Tests

To run tests:

	python tests.py

Tests use an SQLite db.