Coder Social home page Coder Social logo

hlong24399 / url-shortener Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 156 KB

Using Flask, Sqlalchemy, Auth-lib, Flask-Dance and Flask-Sqlalchemy to create url shortener web app.

Python 72.58% HTML 27.42%
urlshortener flask-sqlalchemy flask flask-dance auth-lib sqlite3 python3 env

url-shortener's Introduction

URL Shortener

  • Simple API that will generate encrypted Short Url.

  • This API utilizes Flask and Flask-SQLAlchemy framework. User input will be stored in short-url database.

  • For easy use, click and flask-cli are integrated to make terminal command to create the data table.

  • Auth-lib is integrated to authorize user login with Google OAuth2 authentication.

Install requirement

It is highly recommended to work in venv- python virtual environment to avoid any collisions with your machine's python configuration

Execute the command below to install requirement packages:

pip3 install -r requirements.txt

Configuration

  • You need to obtain OAuth 2.0 client credentials from the Google API Console Platform first to be able to run the authentication.

  • Obtain the google cloud oauth 2.0 client id and secret since we need those to fill out .env.

  • dotenv is used to work with environment variable, .env file must be created in app/.

  • .env file should look like:

FLASK_APP=app
FLASK_SECRET_KEY=<secretkey>
FLASK_ENV=development
OAUTHLIB_INSECURE_TRANSPORT=true
OAUTHLIB_RELAX_TOKEN_SCOPE=true
GOOGLE_CLIENT_ID=<client id generated by google cloud oauth 2.0 service>
GOOGLE_CLIENT_SECRET=<secret generated by google cloud oauth 2.0 service>
DATABASE_URL=sqlite:///short-url.sqlite3

Execution

  1. Create the database

flask create_db

  1. Run the app

flask run

Demo

image image image image image

url-shortener's People

Contributors

hlong24399 avatar

Watchers

 avatar  avatar

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.