commit e0eb103c7ad3d728877ba46bd4e7d99db9af54df Author: Doug Le Tough Date: Sat Nov 25 07:39:01 2017 +0100 Initial commit diff --git a/tetawebapp/.gitignore b/tetawebapp/.gitignore new file mode 100644 index 0000000..a4ce8ab --- /dev/null +++ b/tetawebapp/.gitignore @@ -0,0 +1,4 @@ +*un~ +*.swp +*.pyc +*.wsgi diff --git a/tetawebapp/config.local.py b/tetawebapp/config.local.py new file mode 100644 index 0000000..4d2898d --- /dev/null +++ b/tetawebapp/config.local.py @@ -0,0 +1,2 @@ +SQLALCHEMY_TRACK_MODIFICATIONS = True +SQLALCHEMY_DATABASE_URI = "postgresql://tetawebapp:tetawebapp@localhost/tetawebapp" diff --git a/tetawebapp/config.py b/tetawebapp/config.py new file mode 120000 index 0000000..26e8fb0 --- /dev/null +++ b/tetawebapp/config.py @@ -0,0 +1 @@ +config.local.py \ No newline at end of file diff --git a/tetawebapp/static/fonts/RobotoCondensed-Bold.ttf b/tetawebapp/static/fonts/RobotoCondensed-Bold.ttf new file mode 100644 index 0000000..3e06c7c Binary files /dev/null and b/tetawebapp/static/fonts/RobotoCondensed-Bold.ttf differ diff --git a/tetawebapp/static/fonts/RobotoCondensed-Regular.ttf b/tetawebapp/static/fonts/RobotoCondensed-Regular.ttf new file mode 100644 index 0000000..b9fc49c Binary files /dev/null and b/tetawebapp/static/fonts/RobotoCondensed-Regular.ttf differ diff --git a/tetawebapp/static/images/404.png b/tetawebapp/static/images/404.png new file mode 100644 index 0000000..2752058 Binary files /dev/null and b/tetawebapp/static/images/404.png differ diff --git a/tetawebapp/static/images/add.png b/tetawebapp/static/images/add.png new file mode 100644 index 0000000..0613def Binary files /dev/null and b/tetawebapp/static/images/add.png differ diff --git a/tetawebapp/static/images/dummy_pic.png b/tetawebapp/static/images/dummy_pic.png new file mode 100644 index 0000000..a545628 Binary files /dev/null and b/tetawebapp/static/images/dummy_pic.png differ diff --git a/tetawebapp/static/images/edit.png b/tetawebapp/static/images/edit.png new file mode 100644 index 0000000..f52c063 Binary files /dev/null and b/tetawebapp/static/images/edit.png differ diff --git a/tetawebapp/static/images/login.png b/tetawebapp/static/images/login.png new file mode 100644 index 0000000..b0b3ae7 Binary files /dev/null and b/tetawebapp/static/images/login.png differ diff --git a/tetawebapp/static/images/logo.png b/tetawebapp/static/images/logo.png new file mode 100644 index 0000000..3ff1932 Binary files /dev/null and b/tetawebapp/static/images/logo.png differ diff --git a/tetawebapp/static/images/logout.png b/tetawebapp/static/images/logout.png new file mode 100644 index 0000000..b3806f4 Binary files /dev/null and b/tetawebapp/static/images/logout.png differ diff --git a/tetawebapp/static/images/refresh.png b/tetawebapp/static/images/refresh.png new file mode 100644 index 0000000..2fae1f2 Binary files /dev/null and b/tetawebapp/static/images/refresh.png differ diff --git a/tetawebapp/static/images/save.png b/tetawebapp/static/images/save.png new file mode 100644 index 0000000..1e981f3 Binary files /dev/null and b/tetawebapp/static/images/save.png differ diff --git a/tetawebapp/static/images/search.png b/tetawebapp/static/images/search.png new file mode 100644 index 0000000..7eb60c5 Binary files /dev/null and b/tetawebapp/static/images/search.png differ diff --git a/tetawebapp/static/images/trash.png b/tetawebapp/static/images/trash.png new file mode 100644 index 0000000..5677370 Binary files /dev/null and b/tetawebapp/static/images/trash.png differ diff --git a/tetawebapp/static/styles/colors.css b/tetawebapp/static/styles/colors.css new file mode 100644 index 0000000..2b7593d --- /dev/null +++ b/tetawebapp/static/styles/colors.css @@ -0,0 +1,22 @@ +:root { + --coloured-bg: #FF5D00; + --light-coloured-bg: #FFB387; + --clear-bg: #E5E5E5; + --mid-bg: #BBBBBB; + --dark-bg: #2B2B2B; + --dark-border: #888888; + --text-color: #555555; + --white: #FFFFFF; + --black: #000000; + --font-normal: url("/static/fonts/RobotoCondensed-Regular.ttf") format("truetype"); + --font-bold: url("/static/fonts/RobotoCondensed-Bold.ttf") format("truetype"); + --banner-logo: url(/static/images/logo.png); + --add_icon: url(/static/images/add.png); + --edit_icon: url(/static/images/edit.png); + --login_icon: url(/static/images/login.png); + --logout_icon: url(/static/images/logout.png); + --refresh_icon: url(/static/images/refresh.png); + --save_icon: url(/static/images/save.png); + --search_icon: url(/static/images/search.png); + --trash_icon: url(/static/images/trash.png); +} diff --git a/tetawebapp/static/styles/fonts.css b/tetawebapp/static/styles/fonts.css new file mode 100644 index 0000000..b0b05ed --- /dev/null +++ b/tetawebapp/static/styles/fonts.css @@ -0,0 +1,13 @@ +@font-face { + font-family: "Roboto Condensed"; + font-style: normal; + font-weight: 400; + src: var(--font-normal); +} + +@font-face { + font-family: "Roboto Condensed"; + font-style: normal; + font-weight: 700; + src: var(--font-bold); +} diff --git a/tetawebapp/static/styles/tetawebapp.css b/tetawebapp/static/styles/tetawebapp.css new file mode 100644 index 0000000..d8f98fc --- /dev/null +++ b/tetawebapp/static/styles/tetawebapp.css @@ -0,0 +1,184 @@ +* { + box-sizing: border-box; +} + +body { + margin: 10px; + font-family: "Roboto Condensed"; + background-color: var(--dark-bg); +} + +div.content { + display: flex; + min-height: calc(100vh - 110px); +} + +main > article { + flex: 1; + background-color: var(--clear-bg); +} + +div.content > nav { + flex: 0 0 200px; + background-color: var(--clear-bg); + border-right-color: var(--mid-bg); + border-right-style: solid; + border-right-width: 1px; +} + +div.content > nav { + order: -1; + display: block; +} + +div.content > nav > a { + display: block; + background-color: var(--clear-bg); + font-size: 20px; + color: var(--text-color); + padding: 5px; + text-decoration: none; +} + +div.content > nav > a:hover { + background-color: var(--light-coloured-bg); + cursor: pointer; +} + +main { + color: var(--text-color); + background-color: var(--clear-bg); + width: 100%; +} + +main > article { + padding: 10px; + color: var(--text-color); + display: block; +} + +main > article.error, main > article.error > p { + padding: 10px; + color: var(--text-color); + display: block; + text-align: center; +} + +main > article > h3 { + font-size: 30px; + color: var(--text-color); +} + +main > article > p, +main > article > ul, +main > article > ol { + color: var(--text-color); + text-align: justify; + text-justify: distribute; +} + +main > article > img { + display:inline-block; + border-color: var(--mid-bg); + border-style: solid; + border-width: 1px; +} + +main > article > p > a { + color: var(--coloured-bg); +} + +main > article > p > a:hover { + text-decoration: none; +} + +main > article.right > img { + float: right; + margin: 0 0 0px 10px; +} + +main > article.left > img { + float: left; + margin: 0 10px 0px 0; +} + +header { + height: 65px; + font-size: 34px; + padding: 10px; + text-align: right; + color: var(--white); + background: var(--banner-logo); + background-repeat: no-repeat; + background-position: 10px; + text-shadow: 0 0 1px var(--black); + border-bottom-color: var(--dark-border); + border-bottom-style: solid; + border-bottom-width: 1px; + border-top-color: var(--white); + border-top-style: solid; + border-top-width: 1px; +} + +footer { + height: 35px; + font-size: 12px; + text-align: center; + padding: 1em; + border-bottom-color: var(--white); + border-bottom-style: solid; + border-bottom-width: 1px; + border-top-color: var(--dark-border); + border-top-style: solid; + border-top-width: 1px; +} + +header, footer, +div.content > nav > a.selected { + background-color: var(--coloured-bg); + color: var(--white); +} + +input[type="text"], textarea, select, pre { + border-color: var(--dark-border); + border-style: solid; + border-width: 1px; + background-color: var(--white); + color: var(--text-color); + padding: 5px; + font-family: "Roboto Condensed"; + margin: 5px; +} + +pre { + border-color: var(--coloured-bg); +} + +button, input[type="button"], input[type="submit"] { + border-color: var(--dark-border); + border-style: solid; + border-width: 1px; + background-color: var(--coloured-bg); + color: var(--white); + font-weight: bold; + padding: 5px; + font-family: "Roboto Condensed"; + margin: 5px; + border-radius: 4px; +} + +button:hover, input[type="button"]:hover, input[type="submit"]:hover { + background-color: var(--light-coloured-bg); + color: var(--text-color); + cursor: pointer; +} +input[type="image"] { + width: 16px; + height: 16px; + border-radius: 2px; +} + +input[type="image"]:hover { + background-color: var(--coloured-bg); + cursor: pointer; +} diff --git a/tetawebapp/templates/error.html b/tetawebapp/templates/error.html new file mode 100644 index 0000000..13fa214 --- /dev/null +++ b/tetawebapp/templates/error.html @@ -0,0 +1,12 @@ +{% extends "index.html" %} +{% block title %}Erreur{% endblock %} +{% block nav %}{% endblock %} +{% block main %} +
+

404 - Not found

+ 404 - Not found +

The page you asked for was not found on this server.
+ It may has been lost, it may has never existed.
+ May be we don't care at all...

+
+{% endblock %} diff --git a/tetawebapp/templates/index.html b/tetawebapp/templates/index.html new file mode 100644 index 0000000..a07ecb8 --- /dev/null +++ b/tetawebapp/templates/index.html @@ -0,0 +1,135 @@ + + + + {% block title %}Accueil{% endblock %} + + + + + + + +{% block bodyheader %} + +{% endblock %} +
{% block banner %}TetaWebApp{% endblock %}
+
+ {% block nav %} + + {% endblock%} +
+ {% block main %} +
+

Le putain de titre

+ dummy pic +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, + sed do eiusmod tempor incididunt ut labore +

+

This link may lead to an error page

+

+ et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. +

+
+
+

Le putain de titre 2

+ dummy pic +

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, + sed do eiusmod tempor incididunt ut labore +

+

+ et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. +

+

+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut + aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui + officia deserunt mollit anim id est laborum. +

+
+
+

Inputs demo

+
    +
  • plop
  • +
  • plap
  • +
  • plip
  • +
+
    +
  1. plop
  2. +
  3. plap
  4. +
  5. plip
  6. +
+ + +
+ +
+ + +
+ +
+ + + + + + + + +
+
+#!/bin/sh
+# This is code sample
+while [ 1 ]
+do
+  echo "Tits or GTFO !"
+  sleep .1
+done
+        
+
+ {% endblock %} +
+
+ {% block footer %} + + {% endblock%} + + diff --git a/tetawebapp/tetawebapp.py b/tetawebapp/tetawebapp.py new file mode 100755 index 0000000..d2efb98 --- /dev/null +++ b/tetawebapp/tetawebapp.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 + +# Required modules +from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash +from functools import wraps + +# Optionnal modules +import psycopg2 +from flask_sqlalchemy import SQLAlchemy + +######################################################################## +# App settings +######################################################################## +app = Flask(__name__) +# Path to static files +app.static_url_path='/static' +# Set debug mode to False for production +app.debug = True +# Various configuration settings belong here (optionnal) +app.config.from_pyfile('config.local.py') +# Generate a new key: head -n 40 /dev/urandom | md5sum | cut -d' ' -f1 +app.secret_key = 'ce1d1c9ff0ff388a838b3a1e3207dd27' +# Feel free to use SQLAlchemy (or not) +db = SQLAlchemy(app) + +app.menu = [('accueil', '/plap.html', 0), + ('Motherfuckisme', '/plap.html', 1 ), + ('We make porn', '/plap.html', 0 ), + ('mes couilles sur la comode3', '/plap.html', 0 ), + ('mes couilles sur la comode4', '/plap.html', 0 ), + ('mes couilles sur la comode5', '/plap.html', 0 ), + ('mes couilles sur la comode6', '/plap.html', 0 ), + ('mes couilles sur la comode7', '/plap.html', 0 ) + ] + +######################################################################## +# Routes +######################################################################## +@app.errorhandler(404) +def page_not_found(e): + """ 404 not found """ + return render_template('error.html', menu=app.menu), 404 + + +@app.route("/", methods=['GET', 'POST']) +def index(): + return render_template('index.html', menu=app.menu) + + + +######################################################################## +# Main +######################################################################## +if __name__ == '__main__': + app.run(host='0.0.0.0')