- update packages
- run
pip install -r .\requirements.txt
- equally to update requirements just run
pip freeze > .\requirements.txt
- run
-
This flask is designed around using a POSTGRESQL database. however altering the SQLALCHEMY_DATABASE_URI in the init.py file will allow you to use other DBMS.
-
Install postgresql from the official website and set your password during installation.
-
Add the postgres bin folder to the environment variables.
-
Next open a termainal and type
psql -U postgres
to open the postgres shell. This is the superuser default for postgres and should use your password you set up during installation. -
Create a database by typing
CREATE DATABASE processnavigator;
in the shell. This will create a database called processnavigator. -
Create a user by typing
CREATE USER processnavigator WITH PASSWORD 'test';
in the shell. This will create a user called processnavigator with the password 'test'. -
Change the ownership of the database to the user by typing
ALTER DATABASE processnavigator OWNER TO processnavigator;
in the shell. This should grant the user full access to the database. -
Exit the shell by typing
\q
. -
Now we need to create the tables from the schema in the python shell. To do this open a terminal and type
flask --app process_navigator shell
. This will open the python shell with the app context. -
Now type the following commands in the shell to create the tables:
db.create_all()
-
Now you should have a database with the tables created.
-
Exit the shell by typing
exit()
. -
This should be one time setup. Any commands such as
db.drop_all()
will drop all the tables in the database and remove all data. HANDLE WITH CARE.
- open up virtual environment with
.\.venv\Scripts\activate
in the terminal - type and run
flask --app .\process_navigator\ run --debug
in the terminal
The instance folder is in the gitignore folder. So, this is where to store anything specific to this instance of the app, such as databases, config e.t.c.
You could also use this to run the app with multiple databases depending on what arguments you pass to the flask cli.
There is package called black
installed which can be run from terminal black _directory_
and it will automatically format your files to a pep8 standard