Linux hosting

This commit is contained in:
Miguel Grinberg 2013-04-14 23:13:17 -07:00
parent f43818315e
commit 89ff1621f8
7 changed files with 31 additions and 9 deletions

View File

@ -19,7 +19,7 @@ oid = OpenID(app, os.path.join(basedir, 'tmp'))
mail = Mail(app)
babel = Babel(app)
if not app.debug:
if not app.debug and MAIL_SERVER != '':
import logging
from logging.handlers import SMTPHandler
credentials = None

View File

@ -6,13 +6,13 @@
{% else %}
<title>microblog</title>
{% endif %}
<link href="/static/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/static/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="{{ url_for('.static', filename = 'css/bootstrap.min.css') }}" rel="stylesheet" media="screen">
<link href="{{ url_for('.static', filename = 'css/bootstrap-responsive.min.css') }}" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/moment.min.js"></script>
<script src="{{ url_for('.static', filename = 'js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('.static', filename = 'js/moment.min.js') }}"></script>
{% if g.locale != 'en' %}
<script src="/static/js/moment-{{g.locale}}.min.js"></script>
<script src="{{ url_for('.static', filename = 'js/moment-' + g.locale + '.min.js') }}"></script>
{% endif %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
@ -44,7 +44,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="/">microblog</a>
<a class="brand" href="{{ url_for('index') }}">microblog</a>
<ul class="nav">
<li><a href="{{ url_for('index') }}">{{ _('Home') }}</a></li>
{% if g.user.is_authenticated() %}

View File

@ -12,7 +12,10 @@ OPENID_PROVIDERS = [
{ 'name': 'Flickr', 'url': 'http://www.flickr.com/<username>' },
{ 'name': 'MyOpenID', 'url': 'https://www.myopenid.com' }]
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
if os.environ.get('SQLALCHEMY_DATABASE_URI') is None:
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db') + '?check_same_thread=False'
else:
SQLALCHEMY_DATABASE_URI = os.environ['SQLALCHEMY_DATABASE_URI']
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_RECORD_QUERIES = True
WHOOSH_BASE = os.path.join(basedir, 'search.db')
@ -21,7 +24,7 @@ WHOOSH_BASE = os.path.join(basedir, 'search.db')
DATABASE_QUERY_TIMEOUT = 0.5
# email server
MAIL_SERVER = 'your.mailserver.com'
MAIL_SERVER = '' # your mailserver
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False

1
killpython Executable file
View File

@ -0,0 +1 @@
killall /home/apps/microblog/flask/bin/python

10
runp-mysql.fcgi Executable file
View File

@ -0,0 +1,10 @@
#!flask/bin/python
# use mysql
os.environ['SQLALCHEMY_DATABASE_URI'] = 'mysql://apps:apps@localhost/apps'
from flup.server.fcgi import WSGIServer
from app import app
if __name__ == '__main__':
WSGIServer(app).run()

6
runp-sqlite.fcgi Executable file
View File

@ -0,0 +1,6 @@
#!flask/bin/python
from flup.server.fcgi import WSGIServer
from app import app
if __name__ == '__main__':
WSGIServer(app).run()

View File

@ -15,6 +15,8 @@ else:
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'sqlalchemy==0.7.9'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask-sqlalchemy'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'sqlalchemy-migrate'])
if sys.platform != 'win32':
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'mysql-python'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask-whooshalchemy'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask-wtf'])
subprocess.call([os.path.join('flask', bin, 'pip'), 'install', 'flask-babel'])