Compare commits
4 commits
28e4ae478e
...
9f4e06d7f9
Author | SHA1 | Date | |
---|---|---|---|
9f4e06d7f9 | |||
8238e9555a | |||
f5fe17fa5c | |||
925164e21d |
7 changed files with 122 additions and 2 deletions
20
app.py
20
app.py
|
@ -4,8 +4,26 @@ app = Flask(__name__)
|
|||
|
||||
|
||||
@app.route('/')
|
||||
def hello_world(): # put application's code here
|
||||
def home(): # put application's code here
|
||||
return render_template('home.html')
|
||||
|
||||
|
||||
@app.route('/random')
|
||||
def random_image():
|
||||
# TODO Implement
|
||||
return NotImplementedError
|
||||
|
||||
|
||||
@app.route('/daily')
|
||||
def daily_image():
|
||||
# TODO Implement
|
||||
return NotImplementedError
|
||||
|
||||
|
||||
@app.route('/all')
|
||||
def all_images():
|
||||
# TODO Implement
|
||||
return NotImplementedError
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0')
|
||||
|
|
17
db/connector.py
Normal file
17
db/connector.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import os
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
user = os.environ['DB_USER']
|
||||
password = os.environ['DB_PASSWORD']
|
||||
host = os.environ['DB_HOST']
|
||||
port = os.environ['DB_PORT']
|
||||
database = os.environ['DB_DATABASE']
|
||||
|
||||
|
||||
def get_connection():
|
||||
return create_engine(
|
||||
url="mysql+pymysql://{0}:{1}@{2}:{3}/{4}".format(
|
||||
user, password, host, port, database
|
||||
)
|
||||
)
|
18
db/model/image_table.py
Normal file
18
db/model/image_table.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import sqlalchemy as db
|
||||
|
||||
from db import connector
|
||||
|
||||
engine = connector.create_engine
|
||||
|
||||
metadata_obj = db.MetaData()
|
||||
|
||||
profile = db.Table(
|
||||
'images',
|
||||
metadata_obj,
|
||||
db.Column('id', db.Integer, primary_key=True),
|
||||
db.Column('location', db.String),
|
||||
db.Column('copyright', db.String),
|
||||
db.Column('date_added', db.TIMESTAMP),
|
||||
)
|
||||
|
||||
metadata_obj.create_all(engine)
|
26
static/css/styles.css
Normal file
26
static/css/styles.css
Normal file
|
@ -0,0 +1,26 @@
|
|||
body {
|
||||
background-image: url("/random");
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
body nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
width: 100vw;
|
||||
padding: 0 20px;
|
||||
}
|
||||
body nav ul > li {
|
||||
color: white;
|
||||
}
|
||||
body nav ul > li :hover {
|
||||
color: #13678A;
|
||||
animation: ease-in;
|
||||
}
|
||||
body h1 {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=styles.css.map */
|
1
static/css/styles.css.map
Normal file
1
static/css/styles.css.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAGA;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE,OAnBD;EAoBC;;AAKN;EACE;EACA","file":"styles.css"}
|
|
@ -0,0 +1,31 @@
|
|||
// Variables
|
||||
$blue: #13678A;
|
||||
|
||||
body {
|
||||
background-image: url("/random");
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
width: 100vw;
|
||||
padding: 0 20px;
|
||||
|
||||
ul > li {
|
||||
color: white;
|
||||
|
||||
:hover {
|
||||
color: $blue;
|
||||
animation: ease-in;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
|
@ -3,8 +3,17 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>DCSL Image Hosting Server</title>
|
||||
<link type="text/css" href="/static/css/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/daily">Daily Wallpaper</a></li>
|
||||
<li><a href="/random">Random Wallpaper</a></li>
|
||||
<li><a href="/all">All Wallpapers</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<h1>Welcome to the DCSL Image Hosting Server!</h1>
|
||||
<h2> - Serving images since year 2022</h2>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue