Coder Social home page Coder Social logo

omaralbeik / flaskbooks Goto Github PK

View Code? Open in Web Editor NEW
20.0 6.0 3.0 446 KB

A very light social network & RESTful API for sharing books using flask!

License: MIT License

Python 64.43% HTML 32.36% CSS 2.62% Makefile 0.59%
python backend web rest-api api flask jinja2 sqlite3 sqlalchemy database orm server

flaskbooks's Introduction

A very light social network for sharing books built using Flask and Python 3

Main Features

Web Endpoints

  • /books: All books (homepage).
  • /books/new: Create a new book.
  • /book/book_id: Book page.
  • /book/book_id/edit: Edit book.
  • /book/book_id/delete: Delete book.
  • /genres: All genres.
  • /genres/new: Create a new genre.
  • /genre/genre_id: Genre page.
  • /genre/genre_id/edit: Edit genre.
  • /genre/genre_id/delete: Delete genre.
  • /users: All users.
  • /user/user_id: User page.
  • /user/user_id/edit: Update user info.
  • /auth: Login page.

RESTful Endpoints

  • /books/JSON: All books JSON.
  • /book/book_id/JSON: Book JSON.
  • /genres/JSON: All genres JSON.
  • /genre/genre_id/JSON: Genre JSON.
  • /users/JSON: All users JSON.
  • /user/user_id/JSON: User JSON.

How to Run

Setup a Google+ authentication app

  1. go to https://console.developers.google.com/project and login with your Google account.
  2. Create a new project
  3. Select "API's and Auth -> Credentials -> Create a new OAuth client ID" from the project menu
  4. Select Web Application
  5. On the consent screen, type in a product name and save.
  6. In Authorized javascript origins add: http://0.0.0.0:5000 and http://localhost:5000
  7. Click create client ID
  8. Click download JSON and save it into the root director of this project.
  9. Rename the JSON file "client_secret.json"
  10. Replace the old client_secret.json file with yours

Run on a Vagrant virtual machine:

Please ensure you have Python, Vagrant and VirtualBox installed. This project uses a pre-congfigured Vagrant virtual machine which has all required packages installed.

  1. In the root directory, use the command vagrant up, this will install the vagrant machine.
  2. Once it's complete, type vagrant ssh to login to the VM.
  3. In the vm, cd /vagrant/flaskbooks
  4. type make to install dependencies and setup the database
  5. type python3 application.py to start the server.

Run on your Linux server:

  1. Use this tutorial from digitalocean to set up your Nginx and run the application on Ubuntu 16.04
  2. type make to install dependencies and setup the database

Open in your browser

Now you can open in a webpage by going to either: http://0.0.0.0:5000, http://localhost:5000, or your set domain

Project Structure

Data Model

flask-books stores data using SQLite3 and SQLAlchemy for object mapping.

Model objects:

  • User
  • Book
  • Genre
  • Like

Model Diagram

model.py

Support the project

Please star the project to let me know you liked it!

Get involved:

Your feedback is always appreciated and welcomed. Please send me an email to [email protected] if you have any questions, or fork the project and get your hand dirty with the code and submit a Pull Request :)

flaskbooks's People

Contributors

omaralbeik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.