This application is made within the course "Tietokantasovellus" at University of Helsinki. It enables persons interested in learning modern jazz dance to sign up for dance classes offered by Aida Dance School. The app also has a admin section where the courses and enrolments can be managed. You can use it here: https://aidadanceschool.herokuapp.com
info@aidadanceschool.com & aidarocks_
student12@student.com & <3aidadance
- Clone this git repository to your computer
- Download pg-install.sh from https://github.com/hy-tsoha/local-pg and run it according to the instructions
- cd into the folder for this repo
- create an .env file with
- DATABASE_URL=postgresql:///user"
- SECRET_KEY= the result you get when you run the following in python
import secrets
>>> secrets.token_hex(16)
- Create a virtual environment for this project ( I use conda) and install the required packages (I use pip):
conda create --name <yourname>
conda activate <yourname>
pip install -r requirements.txt
- Start the database:
start-pg.sh
- Open a new terminal and populate the database with the default tables and base data:
psql < db_setup.sql
- Run the app as shown below and then open the local version of the app in http://127.0.0.1:5000/
export FLASK_ENV=development #This will a.o. restart the server when you make changes in the code
flask run
- Develop the code and see the changes in your browser. If you haven't already, init a new git repo (git init) and make regular commits
- If you do not already have one, create a free account at heroku.com
- Create a new app with a name of your choice
- Login to Heroku in the terminal and attach your git repo to heroku
heroku login
heroku git:remote -a <nameofyourapp>
- Create a Postgres database in Heroku and populate it wit our tables and test data. Add the secret key to it
heroku addons:create heroku-postgresql
heroku psql < db_setup.sql
heroku config:set SECRET_KEY=<yoursecretkeyhere>
- Publish the app in Heroku. Heroku will inform you about the url wher you can use it
git push heroku main
- See an overview of upcoming courses
- Register for a course
- Remove the registration. This is possible if the course has not yet started
- Create a personal profile
- Edit the personal profile
- Delete the personal profile. This is possible if the user is not registered to an ongoing or upcoming course
- See an overview of ongoing and upcoming courses
- Create a new course
- Delete a course. This is possible if there is no registrations for the course
- List students
- List teachers
- Add teachers
- List dance rooms
- USERS((pk) username:string, password:string, firstname:string, lastname:string, phone:string, bornyear:integer, usertype:string, removed: boolean)
- TEACHERS((pk) id:serial,firstname:string, lastname:string, email:string, hourlysalary:float)
- ROOMS((pk) id:serial, m2:float, capacity:int)
- COURSES((pk) id:serial, startdate:date, finishdate:date,time:time, durationhour:float, occurances:int, (fk) teacherid -> Teachers, (fk) roomid -> Rooms)
- COURSESENROLMENT((pk) id:serial, (fk) courseid -> Courses,(fk) userid -> Users - On delete set null)
The base functionality of the application is almost finished. What is missing is the admin's ability to delete a course. After that is set up, I will improve the stability of the app (validating input, error catching).
All base functionality is now in place. I have also added access control to the routes and implemented error handling. The layout is also more complete and I have divided the code into files and impoved the code style. In my opinion, the app is now almost finished. I await feedback and will do the last finish up after that. Instructions for where and how to test the app is found on the top of this Readme file.
I have modularized the app furthermore, fixed the reported duplicate username crash problem (#2) and tidied up the code. Instructions for where and how to test the app is found on the top of this Readme file.