diff --git a/src/app/model.py b/src/app/model.py index cf4b37a..27a42cb 100644 --- a/src/app/model.py +++ b/src/app/model.py @@ -4,7 +4,7 @@ import mysql.connector db = mysql.connector.connect( user='root', password='root', - host='10.5.0.5', + host='0.0.0.0', database='db' ) diff --git a/src/app/static/stylesheet.css b/src/app/static/stylesheet.css index 3704e43..4f14609 100644 --- a/src/app/static/stylesheet.css +++ b/src/app/static/stylesheet.css @@ -1,3 +1,13 @@ body { - background-color: gray + background-color: lightblue; + display: flex; /* or inline-flex */ + flex-direction: column +} + +h1 { + margin: auto; +} + +img { + margin: auto; } \ No newline at end of file diff --git a/src/app/templates/index.html b/src/app/templates/index.html index a3225e9..b9ff4e5 100644 --- a/src/app/templates/index.html +++ b/src/app/templates/index.html @@ -1,7 +1,6 @@ -$def with (login_form, friends) - Friends + Beelance2 @@ -9,9 +8,9 @@ $def with (login_form, friends) -

Friends

+

Beelance2

- Friends + Honeybee

@@ -19,19 +18,6 @@ $def with (login_form, friends)
- Guestbook -

Log In

-
- $:login_form.render() -
- $if session.username: -

Logged in as $session.username

- Logout - -

Registered friends:

- \ No newline at end of file diff --git a/src/app/views.py b/src/app/views.py index 1b64341..021aaa8 100644 --- a/src/app/views.py +++ b/src/app/views.py @@ -4,10 +4,11 @@ import model # Define application routes urls = ( - '/', 'index', - '/logout', 'logout', - '/register', 'register', - '/guestbook', 'guestbook', + '/', 'Index', + '/login', 'Login', + '/logout', 'Logout', + '/register', 'Register', + '/guestbook', 'Guestbook', ) # Initialize application using the web py framework @@ -26,17 +27,21 @@ else: # Add session to global variables render._add_global(session, 'session') +class Index(): + + # Get main page + def GET(self): + return render.index() -class index(): +class Login(): - # Get main page def GET(self): # Show other registered users if the user is logged in if session.username: friends = model.get_users() else: friends = [[],[]] - return render.index(login_form, friends) + return render.login(login_form, friends) # Log In def POST(self): @@ -49,10 +54,10 @@ class index(): session.username = data.username else: friends = [[],[]] - return render.index(login_form, friends) + return render.login(login_form, friends) -class register: +class Register: # Get the registration form def GET(self): @@ -65,7 +70,7 @@ class register: raise web.seeother('/') -class guestbook: +class Guestbook: # Get guestbook entries def GET(self): @@ -80,7 +85,7 @@ class guestbook: model.set_guestbook_entry(data.entry) return web.seeother("/guestbook") -class logout: +class Logout: # Kill session def GET(self):