Giter VIP home page Giter VIP logo

flask-esipy-example's Introduction

Flask + EsiPy Example

This project is a small ready to work example on how to use EsiPy with Flask.

The following libraries are used:

You will also require:

  • Virtualenv to setup virtualenv
  • Depending on the database you want to use, the required libraries (by default this example uses SQLite, which is embedded in Python)

Also, this example is made with Python 2.7, it might works with Python 3, but you may have to correct some lines of code

Get and init the project

  1. Clone the repository on your system
git clone https://github.com/Kyria/flask-esipy-example.git
  1. Create a virtualenv
cd flask-esipy-example
virtualenv venv
source venv/bin/activate
  1. Install requirements
pip install -r requirements.txt
  1. Setup the FLASK_APP environment variable
export FLASK_APP=app.py
  1. Go to https://developers.eveonline.com
  2. Login and go to manage applications
  3. Create a new application
  4. Fill all the fields

Requirements:

  • For the scope, you will need esi-wallet.read_character_wallet.v1 for this example
  • The callback URL must be http://<SOME_IP_OR_DOMAIN>:<SOME_PORT>/sso/callback

APP Configuration

  1. Copy and rename the config.dist in config.py
  2. Edit it.
PORT = <SOME_PORT>
HOST = '<SOME_IP_OR_DOMAIN>'

SQLALCHEMY_DATABASE_URI = 'sqlite:///app.db'  # this is your database connection informations http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls

# Fill these lines with the data you get from https://developers.eveonline.com
ESI_SECRET_KEY = ''  # your secret key
ESI_CLIENT_ID = ''  # your client ID

How to start everything

First, you will need to run the migration to create the required user table

flask db upgrade

INFO [alembic.runtime.migration] Context impl SQLiteImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade -> fab636b98bc7, create_user_table

Run the app

python app.py
  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 206-933-487
  • Running on http://localhost:5015/ (Press CTRL+C to quit)

And now you can connect to http://localhost:5015/ to see it working (if you kept default configs)

flask-esipy-example's People

Contributors

kyria avatar ditchbuster avatar

Watchers

James Cloos avatar Manuel Alejandro Núñez Liz 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.