Skip to content

UTCSheffield/python-web-orm-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Web ORM Starter App

Python Flask Render

A simple Python Todo Web App and a stripped-down version of https://github.com/UTCSheffield/python-web-oauth-orm-rest-starter. This version removes auth, admin, and API layers so you can concentrate on data classes and page routes.


Features

Flask

  • Flask based Python Webserver with routing (a function for each url endpoint users can visit)
  • HTML / Jinja templates for looping though and outputting data.
  • todo.py contains the endpoints for the Todo app

SQLAlchemy & SQLite / PostgreSQL


  • ORMs build the database for you from your classes so you define what you want to store how it connects together and any extras calculations / functions you need .
  • Start with SQLite but you can move to professional systems like PostgreSQL or others when you are ready.
  • todo.py includes the Todo class that provides all you need for the building of the database and all the CRUD.

Setup

Start from the Template

  1. Login to github.com
  2. Go to the github repository https://github.com/UTCSheffield/python-web-orm-starter
  3. Click the green "Use this template" button at the top of the page
  4. Select "Create a new repository"
  5. Fill in your new repository details:
    • Choose a repository name
    • Add a description (optional)
    • Choose Public or Private visibility
  6. Click "Create repository from template"
  7. Your new repository will be created with all the template files

Clone your Repository locally

Using GitHub Desktop:

  1. On the GitHub page for your new repository
  2. Click the green "Code" button
  3. Click "Open with GitHub Desktop"
  4. You may need to login to GitHub Desktop if you haven't already
  5. You may be prompted to choose a local path to clone the repository to
  6. Click 'Open in Visual Studio Code' to open the project in VS Code

Install Dependencies

Open a Terminal

py -m pip install -r requirements.txt # It may need python3 on some systems

Running the Application

Start the Flask development server:

py -m flask run # It may need python3 on your systen

The app will be available at http://localhost:5000

Try it and create a few tasks!


The Database

This code uses SQLAlchemy to set up classes that have methods to talk to many databases. We use SQLite for simplicity and easy local development.

Local Development (SQLite)

The database file is stored in /instance/todo.db

Hopefully Visual Code has promoted you to install the recommended extensions including the SQLite extension. and so todo.db should appear in the left hand side explorer view with a red icon.

Have a look, can you see the tables and data?

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors