A very light social network for sharing books built using Flask and Python 3
/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.
/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.
- go to https://console.developers.google.com/project and login with your Google account.
- Create a new project
- Select "API's and Auth -> Credentials -> Create a new OAuth client ID" from the project menu
- Select Web Application
- On the consent screen, type in a product name and save.
- In Authorized javascript origins add: http://0.0.0.0:5000 and http://localhost:5000
- Click create client ID
- Click download JSON and save it into the root director of this project.
- Rename the JSON file "client_secret.json"
- Replace the old client_secret.json file with yours
Please ensure you have Python, Vagrant and VirtualBox installed. This project uses a pre-congfigured Vagrant virtual machine which has all required packages installed.
- In the root directory, use the command
vagrant up
, this will install the vagrant machine. - Once it's complete, type
vagrant ssh
to login to the VM. - In the vm,
cd /vagrant/flaskbooks
- type
make
to install dependencies and setup the database - type
python3 application.py
to start the server.
- Use this tutorial from digitalocean to set up your Nginx and run the application on Ubuntu 16.04
- type
make
to install dependencies and setup the database
Now you can open in a webpage by going to either: http://0.0.0.0:5000, http://localhost:5000, or your set domain
- static: Bootstrap, images, styles
- templates: html templates
- application.py: Flask application
- client_secrets.json: Google client secrets / replace this with yours
- dbhelpers.py: common helper functions for database objects
- helpers.py: common helper functions
- model.py: data model objects
flask-books stores data using SQLite3 and SQLAlchemy for object mapping.
- User
- Book
- Genre
- Like
Please star the project to let me know you liked it!
Your feedback is always appreciated and welcomed. Please send me an email to omaralbeik@gmail.com if you have any questions, or fork the project and get your hand dirty with the code and submit a Pull Request :)