Git Product home page Git Product logo

sanic-starter's Introduction

Sanic-Starter

A good starting point with Sanic using Class based views, Alembic and SQLAlchemy.

Getting started

Clone the repo, open up terminal and run:

make init

This will create a python3 virtual environment and install all of the dependencies. Also it will create a .env file for you with empty export DATABASE_URL which needs to get filled to perform migrations.

Caveats

make init assumes you have python3 installed and pip3 in your $PATH.

You must import ALL of the new models you create into the app/models/__init__.py file underneath the Base = declarative_base() declaration. This will ensure that your models will be picked up automatically when running make revision.

DATABASE_URL is the environment variable being used to run the migrations. You will have to create your own database and update the export DATABASE_URL="database url here" in the .env file. using something like autoenv makes exporting settings easy. If you have a different or preferred way of doing this you will have to update the /alembic/env.py and the app/database.py file to reflect your preferred way.

Commands

make run - Runs the Sanic server

make revision - Checks all of the Base.metadata and generates a new migration script under /alembic/versions

make upgrade - Runs the revision head and upgrades all database schema.

make downgrade - Drops all of the revision heads tables.

sanic-starter's People

Contributors

robputt avatar seanpar203 avatar

Watchers

 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.