Skip to content

toomistm/ut-db-orm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PS! Use Python version 3.8!!!

Developer and Databeses 101

NB! If you have questions you can write to Karel Paan (karelpaan#2890) in Discord chat ;)

Greetings, wanderer! You have found yourself on a quest to get to know more about the life of a database and how it is used in "real life". Keep in mind that this is only one of many uses for a database. Development being the most common usa we will be talking about just that. And ofcourse you will have plenty of opporunities to make your hands dirty.

Note that this application is not ment to look "nice" or give the best user experience but only to give you an insight into databases in development.

Furthermore, this application uses rather old way of designing an application (monolithic architecture). This is not to say it is good or bad, although nowadays using microservice architecture is much more common, the main thing here is that you get to know databases and get some experience using them in application development.

It is also recommended googling the underlined words ;).

Setup

FORK the repository to your local machine (if you haven't already). I do recommend the web version, but it is up to you. HINT

Install all necessary packages

```bash $ pip install -r requirements.txt ```

To run the application you must first setup environment variables like so:

Mac

```bash $ export FLASK_APP=application $ export FLASK_ENV=development ```

Linux

```bash > set FLASK_APP=application > set FLASK_ENV=development ```

Windows

```bash > $env:FLASK_APP = "application" > $env:FLASK_ENV = "development" ```

Init DB

```bash flask init-db ```

Run

```bash flask run ```

Assignment 0

For your changes to work you need to rerun the project after every change, this process is mad easy by PyCharm ;).
  • Read the before manual, start the application (default port is 5000, if you waht to change that, use `flask run --host=0.0.0.0 --port=80`)
  • Register an account
  • Log in
  • Create a post
  • Try to edit a post (THIS SHOULDN'T WORK)

Assignment 1

Your first task is to implement SQL queries `get_post` and `update` inside application/blog.py. Tip: Look at `index` and `create` functions respectively.
  • Implement beforementioned SQL scripts
  • Try to edit a post again, now it should be working, if not, you did something wrong!

Running tests

If all assignments are done correctly then all tests should pass. (You can also run the tests inside PyCharm, it makes no difference.) ```bash python -m pytest tests ```

Assignment 2


NB! To start Assignmet 2 checkout to branch "assignment2"!


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 70.6%
  • HTML 19.8%
  • CSS 9.6%