There are couple of things you need to do in order to run this simple project.
- Its utter important to check
requirements.txt
first and add your missing packages/modules. Ofcourse, if you want to install all the packages/modules fromrequirements.txt
, you can use:
$ pip install -r requirements.txt --no-index --find-links file:///tmp/packages
this is the explanation of what the above line does.
- You should make a database with two columns.
I used XAMPP's integrated MySQL MariaDB 10.1.34. You can checksidenote.txt
for detailed explanation of how to do this! And ofcourse you can skip the sidenote if you can access MySQL through cmd or phpMyAdmin.
Creating a database in MySQL's prompt:
CREATE DATABASE flaskapp;
now we need to use the created database:
USE flaskapp;
this is to create a table, we're going to use:
CREATE TABLE users(name varchar(20), email varchar(40));
and now lets make a query to the database and make sure its empty:
SELECT * FROM users;
The second thing you need to do is simply open cmd
, go to the directory where you cloned/downloaded flaskwithMySQL.py
and simply type
python flaskwithMySQL.py
to run it.
The command prompt should give you a link to the page, where the form is. If you haven't touched anything, it should be localhost:5000
.
Well the packages you need are written in requirements.txt
, but here we go anyway:
Installation is made with pip install <package name>
- Python 2.7.15 - If you don't have this, you can download it from python.org/downloads
- pip=18.0 - This should be already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4, but anyway, use
python -m pip install -U pip
to upgrade it. - Flask=1.0.2
- Flask-MySQLdb=0.2.0
- mysqlclient=1.3.13
- request=1.0.2
Ofcourse there are couple of side tools you'll need, if you don't have them yet:
- wheel=0.32.0 - A built-package format for Python. To work with wheel (.whl) file formats.
- setuptools=39.0.1 - to easily download, build, install, upgrade, and uninstall Python packages
I think this is uploaded correctly through GitKraken. All rights are not reserved, so clone as much as you want.
Adler Ademov