Coder Social home page Coder Social logo

flask-shop-app's Introduction

About flask-shop-app

A small shop-app showing a company and its catalog of products (available categories and items, including top 10 latest items).

It is possible to register as a new user and use delete, edit and add categories and items functions when logged in.

The app includes a sqlite database to store the products and user information.

Database

To test the program you can download a sample database here with this repository -

flaskshop.db

flaskshop.db consists of 4 tables:

  • categories
  • items
  • users
  • oauth

The tables categories and items are connected via Foreign Keys:

  • items.category = categories.id
  • items.user_id = users.id
  • categories.user_id = users.id
  • oauth.user_id = users.id

Installation/Environment

Requires Python 3.7.1 and Flask 1.0.2.

We recommend using this program in a virtual environment. If you like to do so follow the steps listed here:

Install Virtual Machine

Install Virtual Box

Here's a Download Link where you can download the latest version of VB. If you need help installing and getting started with VB check out the Official Documentation.

Currently (October 2017), the supported version of VirtualBox to install is version 5.1. Newer versions do not work with the current release of Vagrant.

Ubuntu users: If you are running Ubuntu 14.04, install VirtualBox using the Ubuntu Software Center instead. Due to a reported bug, installing VirtualBox from the site may uninstall other software you need.

Install vagrant

You can download vagrant here and install the version for your OS.

Windows users: The Installer may ask you to grant network permissions to Vagrant or make a firewall exception. Be sure to allow this.

VM Configuration

You can download a .zip file with VM configuration files here.

Then follow the following steps using your terminal:

  • cd to the VM config folder (if you didn't change the name it's called FSND Virtual Machine)
  • direct into the vagrant folder $ cd vagrant/
  • start vagrant $ vagrant up (this will install Linux OS)
  • log in to Linux VM with $ vagrant ssh

Install Flask

Official Flask Installation Guide

  • pip3 install Flask

Furthermore you will need the following packages:

flask_migrate
flask_login
flask_dance
passlib
sqlalchemy
sqlalchemy_utils
environs
wtforms
wtforms_alchemy
blinker
flask_script

GitHub Login

To use the GitHub Login functionality

  • create a GitHub account
  • add the app here If you got any problems follow this tutorial. In your app folder create a .env file and add the following two variables there:
  • GITHUB_ID=mygithubid
  • GITHUB_SECRET=mygithubsecret

Run the program

$ python3 app.py

Output example

Catalog Screenshot

Product Detail Screenshot

Screenshot of adding an item

Server Details

Installation log on server

  • apt-get install nano
  • apt-get install git
  • apt-get install python3-pip
  • apt-get install libapache2-mod-wsgi-py3

Configuration changes

  • in etc/ssh/sshd_configchanged port ssh from 22 to 2200
  • installed ufwand made the following changes:
    • ufw default allow outgoing
    • ufw default deny incoming
    • ufw allow ssh
    • ufw allow 2200
    • ufw allow www
    • ufw enable
  • added WSGIScriptAlias to apache2 conf-enabled:
    • new file flaskapp.conf with following content:
WSGIScriptAlias / /usr/share/caros-apps/flaskapp/wsgi/flask.wsgi
WSGIScriptReloading On

<Directory /usr/share/caros-apps/flaskapp/wsgi>
  Order allow,deny
  Allow from all
</Directory>

pip3 packages

  • Flask
  • flask_migrate
  • flask_login
  • flask_dance
  • passlib
  • sqlalchemy
  • sqlalchemy_utils
  • environs
  • wtforms
  • wtforms_alchemy
  • blinker
  • flask_script

Third party resources

  • passlib
  • wtforms
  • environs
  • blinker
  • sqlalchemy

Licence

No licence required.

Help

For any questions please send a message to our support.

flask-shop-app's People

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.