Simple application with authentication and CRUD functionality using the Python Flask micro-framework
To use this template, your computer needs:
- Python 2 or 3
- Pip Package Manager apt install python-pip
apt install mysql-server mysql-server libmysqlclient-dev
Install dependencies with below commands:
- pip install flask flask-mysqldb flask-WTF passlib
- create database myflaskapp;
- use myflaskapp;
- create table users(id INT(10) AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50), email VARCHAR(100), username VARCHAR(30), password VARCHAR(100), register_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
- create table articles ( id INT(11) AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255), author VARCHAR(100), body TEXT, create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP);
- CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'flapass';
- GRANT ALL PRIVILEGES ON myflaskapp.* TO 'appuser'@'localhost';
- Edit app.py and add the MySQL credentials created above.
python app.py