zphrs / lab5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lab 4

Welcome! This week we will be working with user logins and sessions.

  1. If you need to install packages into your environment:

    • pip install -r requirements.txt
    • The only new library is passlib
  2. Let's start by setting up our DB with Postgres (paying attention to the foreign key):

    • psql: CREATE DATABASE lab5;
    • psql: \c lab5
    • psql: CREATE TABLE users(uid SERIAL NOT NULL PRIMARY KEY, username TEXT NOT NULL, password TEXT NOT NULL);
    • psql: CREATE TABLE posts(pid SERIAL NOT NULL PRIMARY KEY, author SERIAL NOT NULL, content TEXT NOT NULL, FOREIGN KEY (author) REFERENCES users(uid));
    • psql: INSERT INTO users (username, password) VALUES ('Michelle', 'test_pw1');
    • psql: INSERT INTO users (username, password) VALUES ('Jasmine', 'test_pw2');
    • psql: INSERT INTO posts (author, content) VALUES (1, 'test_post_1');
    • psql: INSERT INTO posts (author, content) VALUES (2, 'test_post_2');

    OR

    • psql: \i lab5.sql
  3. Everything else we have setup for you in the directory :^). However you will need to uncomment in app.py to discover how this code works out in the app.

  4. Tasks

About


Languages

Language:Python 38.1%Language:HTML 38.1%Language:CSS 19.9%Language:TSQL 3.9%