The task was to develop an application that provided a list of items within a variety of categories as well as provided a user registration and authentication system, giving registered users the ability to post, edit and delete their own items.
I came up with the catalog of chess books. Non-registered users can access all the categories and books in the catalog in read-only mode. Registered users can add new books to existing categories as well as create own categories. They can then update and delete only categories they created and books they added.
db_setup.py
sets up the database and classes >>> model;templates
andstatic
are responsible for the presentation >>> view;app.py
contains main logic of the app >>> controller;
- Make sure Python is installed on your computer. Otherwise, download and install Python 3.7.2 from the download page (see Dependencies above);
- Download and install Oracle VM Virtual Box; make sure the CPU Virtualization is enabled;
- Download and install Vagrant;
- Download and unzip VM configuration files;
- You should have the FSND-Virtual-Machine directory with the vagrant directory inside after the previous step;
- Download and extract this repository so that you have it inside the vagrant directory;
- In your terminal,
cd
to the vagrant directory and run the commandvagrant up
(this causes Vagrant to download the Linux operating system and install it. It may take quite a while depending on how fast your Internet connection is); - Run
vagrant ssh
command to log into the virtual machine; - Run
cd /vagrant
command to access shared files; cd
to the app directory (see step 6);- Run
sudo -u postgres psql
command to log in to the PostgreSQL as admin; - Run
CREATE DATABASE <database>;
command to create new database (replace<database>
with your value); - Run
CREATE USER <username> WITH PASSWORD '<password>';
command to create new database user (replace<username>
and<password>
with your values); - Run
GRANT ALL PRIVILEGES ON DATABASE <database> TO <username>;
command ( replace<database>
and<username>
with your values from steps 12-13); - Log out from the PostgreSQL (
^D
will do in most cases); - Modify
config.py
file to reflect your settings - change the values of DB_NAME, DB_USER, DB_PASSWORD according to the values from steps 12 and 13. Changing APP_KEY is optional; - Make sure you are on the same level with the
db_setyp.py
file; - Run
python db_setup.py
command to create database tables; - Run
python db_populate.py
command to populate the database; - Run
python app.py
command to start the server; - In your browser, open localhost:8000; you will need a Google account and the Internet connection to log in.