96 lines
12 KiB
Python
96 lines
12 KiB
Python
|
#coding: utf-8
|
||
|
|
||
|
import bottle
|
||
|
|
||
|
content = """
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head lang="cs">
|
||
|
<meta charset="UTF-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
<title>Roští.cz</title>
|
||
|
<style>
|
||
|
body {
|
||
|
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||
|
color: #2a303c;
|
||
|
background: #54af46;
|
||
|
}
|
||
|
.header {
|
||
|
text-align: center;
|
||
|
}
|
||
|
pre, .row p {
|
||
|
text-align: left;
|
||
|
}
|
||
|
.container {
|
||
|
width: 800px;
|
||
|
margin: 50px auto;
|
||
|
background: #fff;
|
||
|
padding: 20px;
|
||
|
-webkit-border-radius: 5px;
|
||
|
-moz-border-radius: 5px;
|
||
|
border-radius: 5px;
|
||
|
text-align: center;
|
||
|
}
|
||
|
a {
|
||
|
color: #54af46;
|
||
|
}
|
||
|
.project-domain {
|
||
|
color: #54af46;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="container">
|
||
|
<div class="header" role="banner">
|
||
|
<a href="https://rosti.cz"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKkAAABGCAYAAAC3x7R4AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gsaEh06ilaTpQAAGElJREFUeNrtnXm0HEW9xz/3kgVCEgkhrLJDEpqlOwjIC52QKIwKHuLI+NgUaUBWFXnogI8HARTBkQCCC6sDAhFhdECQwLAF0oQdeljaoLKFCCQBQvbtcu/7o37NrTS9zdybQGB+5+Rkbnd1VVfVt357VUOLWtSi5qhQza3yf4ta9EkFanuhmmtrjcRnm9o/yVwUaAP+uzVNn236xHKpQjU3FugCzgMOAJZW8rXWjLU46SeHk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ajBwv2h77l/zRKh7C2QPiVcUf/3bhKD9j33zghDQKeRKW0+FojxQjW3E/AicBrwaiVf64jQRwH2SqhvthhEwYTME27RDO2CSuF7zLDs46OypSS9bquEOp5NaSMpUWZFAztBTw/pjOfFqSwyVx2+516RJYFGu38xcJCmOp7ne+7lKapQwyAdm2Sd+Z67p++5e+v/hLvEUS4JoAKqTVPe6WkpO1Ks8vVR0aTLo/TRQjW3rrjC4ujtAKTiVukEJpIeoUqivsAVhmU7EUAdAgxL0NPfSuFS49IWcAYu9/mQynC777mz455rQNfWgf0z1OkzAV3se+5EcWtmdi2ldWQQ8Vs1koyXJKNmB8OyN0/o5PAM7z5TDoq4QvcrVvK1ZTERqLQNfvVKvtYVGuT7RET1BKgAkwzL3izkDN8gAaTzxXCK
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div>
|
||
|
<h2>Kde to jsem?</h2>
|
||
|
<h3 class="project-domain"></h3>
|
||
|
<p>
|
||
|
Na <a href="https://rosti.cz">Roští.cz</a> a prostředí pro vaši aplikaci je připraveno. Nyní můžete obsah adresáře <code>/srv/app</code> vymazat a nahradit ho svoji aplikací. K aplikaci také nezapomeňte nahrát soubor app.py (místo tohoto) a vložit do něj volání své aplikace pro webový server gunicorn.
|
||
|
</p>
|
||
|
<p>
|
||
|
Nejčastěji naši uživatelé používají Django. V takovém případě vypadá soubor <code>app.py</code> takto:
|
||
|
</p>
|
||
|
<pre class="prettyprint">
|
||
|
import os
|
||
|
|
||
|
# Pokud se settings nachází v /srv/app/moje_aplikace,
|
||
|
# bude obsah pro DJANGO_SETTINGS_MODULE: moje_aplikace.settings
|
||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "moje_aplikace.settings")
|
||
|
|
||
|
from django.core.wsgi import get_wsgi_application
|
||
|
application = get_wsgi_application()
|
||
|
</pre>
|
||
|
|
||
|
<p>Příkladem vám může být i aktuální <code>app.py</code>, přes který se vám zobrazila tato stránka. V něm používáme framework bottle.</p>
|
||
|
<p>Pravděpodobně nemáte svou aplikaci bez závislostí, takže během příprav spuštění vaší aplikace nezapomeňte nahrát soubor requirements.txt do adresáře <code>/srv/app/</code>. Po restartu kontejneru proběhne instalace závislostí automaticky.</p>
|
||
|
<p>Do souboru <code>/srv/app/init.sh</code> můžete napsat příkazy, které se mají spustit po každém restart kontejneru. Můžete si tak usnadnit třeba deployment.</p>
|
||
|
</div>
|
||
|
<p>V případě problémů se prosím obraťte na <a href="mailto:podpora@rosti.cz">technickou podporu</a> nebo na <a href="https://docs.rosti.cz/" target="_blank">dokumentaci</a>.</p>
|
||
|
<p>Tým <a href="https://rosti.cz">Roští.cz</a> | <a href="http://twitter.com/rosti_cz">@rosti_cz</a></p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<script type="application/javascript">
|
||
|
var index, len;
|
||
|
var places = document.getElementsByClassName('project-domain');
|
||
|
var domain = document.domain;
|
||
|
|
||
|
for (index = 0, len = places.length; index < len; ++index) {
|
||
|
places[index].innerHTML = domain;
|
||
|
}
|
||
|
</script>
|
||
|
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
|
||
|
</body>
|
||
|
</html>
|
||
|
"""
|
||
|
|
||
|
@bottle.route('/')
|
||
|
def home():
|
||
|
return content
|
||
|
|
||
|
application = bottle.default_app()
|