You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import os
|
|
|
|
from flask import Flask, render_template, send_file
|
|
|
|
from planets import createRandomPlanet
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
|
|
|
|
IMG_FOLDER = os.path.join('static', 'IMG')
|
|
|
|
app.config['UPLOAD_FOLDER'] = IMG_FOLDER
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
def index():
|
|
|
|
planet = os.path.join(app.config['UPLOAD_FOLDER'], 'planet.png')
|
|
|
|
return render_template('index.html', planet=planet)
|
|
|
|
|
|
|
|
@app.route('/<seed>')
|
|
|
|
def hello(seed):
|
|
|
|
createRandomPlanet(seed)
|
|
|
|
planet = os.path.join(app.config['UPLOAD_FOLDER'], 'planet.png')
|
|
|
|
return send_file(planet)
|
|
|
|
|
|
|
|
if __name__=='__main__':
|
|
|
|
app.run(debug=True, host='0.0.0.0')
|