GithubHelp home page GithubHelp logo

ghandylan / flask-notes Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 376 KB

๐Ÿ“ Web-based note taking app built with Bootstrap and Flask

Home Page: https://flasknotes.pythonanywhere.com/

Python 37.54% JavaScript 0.71% CSS 9.14% HTML 52.60%
flask notes python web

flask-notes's Introduction

Flasknotes

Flasknotes is a simple web-based note taking application built with Flask and MySQL. It features role based authentication, CRUD operations, and favorite notes. It is fully mobile responsive and can be used on any device with an active internet connection

It includes the following features:
  • Role based authentication with Flask-Login which can be edited on rbac.py
  • MySQL database connection with mysqlclient
  • ORM support with Flask-SQLAlchemy
  • .env file support with python-dotenv
  • Powerful template engine Jinja2
  • Database migration support with Flask-Migrate
  • Password hashing and checking with bcrypt
  • Flask-WTF forms with CSRF protection

Screenshots:

Dashboard with CRUD operations and favorite notes

alt text for screen readers

Register Page

alt text for screen readers

Login Page

alt text for screen readers

Pre-requisites:
  • Python 3.6 or above
  • MySQL 5.7 or above
  • IDE of your choice
To run this app on your machine:
  1. Clone this repository using git clone git clone https://github.com/ghandylan/flask-notes

  2. Unzip the folder and open it in your favorite IDE like PyCharm, VSCode, etc.

  3. Open the terminal and create a virtual environment using python -m venv flask_notes

  4. Activate the virtual environment using <env_name>\Scripts\activate on Windows or source flask_notes/bin/activate on Linux/MacOS.

  5. Run pip install -r requirements.txt to install all the dependencies.

  6. Create a .env file and add the following variables:

    • SECRET_KEY - A secret key for your application.
    • SQLALCHEMY_DATABASE_URI - The URI for your MySQL database.
      • Example: mysql://<username>:<password>@localhost:3306/<db_name>
    • SQLALCHEMY_TRACK_MODIFICATIONS - Set it to False.
  7. Make sure your MySQL server is running and create a database with the name you specified in the .env file.

  8. Run the following commands to perform database migrations with Flask-Migrate:

    • flask db init
    • flask db migrate
    • flask db upgrade

    Should you encounter any errors with database migrations, run flask db stamp head and then run the above excluding the flask db init command.

  9. Run python app.py to start the server.

Files in the project:
  1. app.py - The main file which contains the Flask application.
  2. config.py - Contains the configuration for the Flask application. Make sure to use environment variables for sensitive information.
  3. models.py - Contains the database models. Feel free to edit it as per your requirements.
    • By default, it contains a User model which can be used for authentication.
    • User's primary key is a UUIDv4 string to enforce data integrity.
  4. rbac.py - Contains the role based access control logic.
  5. forms.py - Contains the forms for the application. Feel free to edit it as per your requirements.
Folders in the project:
  1. templates contains the HTML templates for the application. Inside that folder, the base.html file contains the base template which is extended by all other templates. Bootstrap 4 is used for styling the templates.
  2. static contains the static files like CSS, JS, images, etc.
  3. migrations contains the database migration files generated by Flask-Migrate.
  4. venv contains the virtual environment for the project.
  5. blueprints contains the blueprints for the application. Use it to organize your application to user/admin views.

flask-notes's People

Contributors

ghandylan avatar

Stargazers

Tyler Hand avatar  avatar  avatar  avatar  avatar Daniel 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.