Skip to content

Commit

Permalink
Better packaging.
Browse files Browse the repository at this point in the history
  • Loading branch information
alfg committed Dec 11, 2013
1 parent 62be48b commit 467393c
Show file tree
Hide file tree
Showing 48 changed files with 25 additions and 19 deletions.
10 changes: 10 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import settings

app = Flask(__name__)
app.secret_key = settings.APP_SESSION_KEY
app.config['SQLALCHEMY_DATABASE_URI'] = settings.DATABASE_URI
db = SQLAlchemy(app)

from app import views
File renamed without changes.
8 changes: 1 addition & 7 deletions models.py → app/models.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import datetime
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.ext.hybrid import hybrid_property


from guildbit import app
import settings

app.config['SQLALCHEMY_DATABASE_URI'] = settings.DATABASE_URI
db = SQLAlchemy(app)
from app import db


class Server(db.Model):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tasks.py → app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def something():
print 'test'
return


@app.task
def delete_server(id):
r = requests.delete("%s/api/v1/servers/%i" % (settings.MURMUR_REST_HOST, id))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/index.html → app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3 class="text-center">Deploy a Mumble server for your group. It's free!</h3>

<div class="ten columns centered text-center">
<p>GuildBit is a free service to deploy temporary Mumble servers for your group. The service is completely
funded by donations. <a href="#">Learn how it works &raquo;</a></p>
funded by donations. <a href="/how-it-works">Learn how it works &raquo;</a></p>
</div>

</div>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2>Your server has expired!</h2>
{% endblock %}

{% block scripts %}
<script src="/static/js/libs/moment.min.js"></script>
<script src="/app/static/js/libs/moment.min.js"></script>

<script type="text/javascript">
// Format expiration date into human friendly
Expand Down
13 changes: 3 additions & 10 deletions guildbit.py → app/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import uuid

from flask import Flask
from flask import render_template, redirect, url_for, jsonify
from flask.ext.classy import FlaskView, route
import requests

from forms import DeployServerForm
from models import *
import settings
import tasks

app = Flask(__name__)
app.secret_key = settings.APP_SESSION_KEY
from app import app, tasks
from app.forms import DeployServerForm
from app.models import Server


class HomeView(FlaskView):
Expand Down Expand Up @@ -101,9 +97,6 @@ def users(self, id):
return jsonify(users=users)



HomeView.register(app, route_base='/')
ServerView.register(app)

if __name__ == '__main__':
app.run(debug=settings.APP_DEBUG, host=settings.APP_HOST, port=settings.APP_PORT)
5 changes: 5 additions & 0 deletions runserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from app import app
import settings

if __name__ == '__main__':
app.run(debug=settings.APP_DEBUG, host=settings.APP_HOST, port=settings.APP_PORT)
3 changes: 3 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from app.views import app

app = app

0 comments on commit 467393c

Please sign in to comment.