Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:trendrr/whirlwind
- Loading branch information
Showing
25 changed files
with
733 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash -e | ||
|
||
. /lib/lsb/init-functions | ||
|
||
if [[ $1 == -c ]]; then | ||
CONFIG_FILE=$2 | ||
else | ||
CONFIG_FILE=/etc/whirlwind.conf | ||
fi | ||
|
||
if [[ -f $CONFIG_FILE ]]; then | ||
. $CONFIG_FILE | ||
fi | ||
|
||
#DAEMON_DIR=/trendrr/WeatherChannelAdmin | ||
DAEMON=$DAEMON_DIR/main.py | ||
NAME=whirlwind | ||
DESC="whirlwind daemon" | ||
|
||
test -f $DAEMON || exit 0 | ||
|
||
case "$1" in | ||
start) | ||
echo -n "Starting $DESC: " | ||
for PORT in ${PORTS[@]} | ||
do | ||
start-stop-daemon --start --pidfile /var/run/"$NAME-$PORT".pid --chdir $DAEMON_DIR --make-pidfile --background --startas $DAEMON | ||
echo "$NAME $PORT." | ||
done | ||
;; | ||
stop) | ||
echo -n "Stopping $DESC: " | ||
for PORT in ${PORTS[@]} | ||
do | ||
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME-$PORT".pid | ||
rm -f /var/run/"$NAME-$PORT".pid | ||
echo "$NAME $PORT." | ||
done | ||
;; | ||
restart) | ||
echo -n "Restarting $DESC: " | ||
for PORT in ${PORTS[@]} | ||
do | ||
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/"$NAME-$PORT".pid | ||
rm -f /var/run/"$NAME-$PORT".pid | ||
start-stop-daemon --start --pidfile /var/run/"$NAME-$PORT".pid --chdir $DAEMON_DIR --make-pidfile --background --startas $DAEMON | ||
echo "$NAME $PORT." | ||
done | ||
;; | ||
*) | ||
echo "Usage: "$1" {start|stop|restart}" | ||
exit 1 | ||
|
||
esac | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DAEMON_DIR=/trendrr/WeatherChannelAdmin | ||
PORTS=(8000 8001 8002 8003) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
whirlwind/conf/app_template/application/controllers/site_controller.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
#from tornado import web | ||
from mako.template import Template | ||
from whirlwind.core.request import BaseRequest | ||
|
||
from whirlwind.db.mongo import Mongo | ||
import hashlib | ||
import os, StringIO, pycurl | ||
from tornado.web import authenticated | ||
from whirlwind.view.decorators import route | ||
|
||
@route('/') | ||
class IndexHandler(BaseRequest): | ||
def get(self): | ||
template_values = { | ||
'page_id' : 'homepage' | ||
} | ||
self.render_template('/site/welcome.html',**template_values) | ||
#template context variables go in here | ||
template_values = {} | ||
|
||
self.render_template('/site/index.html',**template_values) |
38 changes: 38 additions & 0 deletions
38
whirlwind/conf/app_template/application/views/account/login.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
<%inherit file="/layouts/content.html" /> | ||
|
||
<%def name="body()"> | ||
<div class="form" style="margin:0 auto 0 auto;width: 250px;"> | ||
<div class="title"> | ||
Please Log-in | ||
</div> | ||
<form action="/login" method="post"> | ||
<input type="hidden" name="next" value="${next}" /> | ||
<div class="field"> | ||
<label for="username" class="label"> | ||
Username | ||
</label> | ||
<div class="input"> | ||
<input type="text" id="username" name="username"/> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<label for="password" class="label"> | ||
Password | ||
</label> | ||
<div class="input"> | ||
<input type="password" id="password" name="password"/> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<label for="keep_logged_in"><input type="checkbox" name="keep_logged_in" id="keep_logged_in" /> keep me logged in</label> | ||
</div> | ||
|
||
<div class="buttons"> | ||
<input type="submit" value="Login" class="button" /> | ||
</div> | ||
</form> | ||
</div> | ||
</%def> |
43 changes: 43 additions & 0 deletions
43
whirlwind/conf/app_template/application/views/account/signup.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# -*- coding: utf-8 -*- | ||
<%inherit file="/layouts/content.html" /> | ||
|
||
<%def name="body()"> | ||
<div class="form" style="margin:0 auto 0 auto;width: 250px;"> | ||
<div class="title"> | ||
Please Sign-up | ||
</div> | ||
<form action="/signup" method="post"> | ||
<input type="hidden" name="next" value="${next}" /> | ||
<div class="field"> | ||
<label for="username" class="label"> | ||
Username | ||
</label> | ||
<div class="input"> | ||
<input type="text" id="username" name="username"/> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<label for="password" class="label"> | ||
Password | ||
</label> | ||
<div class="input"> | ||
<input type="password" id="password" name="password"/> | ||
</div> | ||
</div> | ||
|
||
<div class="field"> | ||
<label for="password2" class="label"> | ||
Confirm Password | ||
</label> | ||
<div class="input"> | ||
<input type="password" id="password2" name="password2"/> | ||
</div> | ||
</div> | ||
|
||
<div class="buttons"> | ||
<input type="submit" value="Signup" class="button" /> | ||
</div> | ||
</form> | ||
</div> | ||
</%def> |
21 changes: 21 additions & 0 deletions
21
whirlwind/conf/app_template/application/views/layouts/content.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
<%inherit file="/layouts/htmlPage.html" /> | ||
|
||
### Template for content pages | ||
<%def name="body()"> | ||
<%include file="/shared/flash_messages.html"/> | ||
<div id="wrap"> | ||
<div id="main"> | ||
<%include file="/shared/header.html"/> | ||
<div id="content"> | ||
<div id="content-inner"> | ||
<%def name="body_content()"> | ||
${next.body()} | ||
</%def> | ||
${body_content()} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<%include file="/shared/footer.html"/> | ||
</%def> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
whirlwind/conf/app_template/application/views/shared/_flash_messages.html
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
whirlwind/conf/app_template/application/views/shared/_footer.html
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
whirlwind/conf/app_template/application/views/shared/_masthead.html
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
whirlwind/conf/app_template/application/views/shared/flash_messages.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
% if flash: | ||
<div id="flash-message" class="flash-message"> | ||
<div id="flash-message-list"></div> | ||
</div> | ||
<script> | ||
var message = "<ul id='flash-message-items'>"; | ||
% if 'error' in flash: | ||
% for message in flash['error']: | ||
message += "<li class='error'>${message | h}</li>"; | ||
% endfor | ||
% endif | ||
% if 'notice' in flash: | ||
% for message in flash['notice']: | ||
message += "<li class='notice'>${message | h}</li>"; | ||
% endfor | ||
% endif | ||
% if 'info' in flash: | ||
% for message in flash['info']: | ||
message += "<li class='info'>${message | h}</li>"; | ||
% endfor | ||
% endif | ||
% if 'success' in flash: | ||
% for message in flash['success']: | ||
message += "<li class='success'>${message | h}</li>"; | ||
% endfor | ||
% endif | ||
message += "</ul>"; | ||
showNotification(message, '', function(){}); | ||
</script> | ||
% endif |
9 changes: 9 additions & 0 deletions
9
whirlwind/conf/app_template/application/views/shared/footer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
<div id="footer"> | ||
<div id="footer-inner"> | ||
<div id="copyright"> | ||
© <script>document.write(Date.today().toString("yyyy"));</script>. All rights reserved. | ||
</div> | ||
</div> | ||
</div> |
20 changes: 20 additions & 0 deletions
20
whirlwind/conf/app_template/application/views/shared/header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
<div id="header"> | ||
<div id="header-inner"> | ||
<div id="logo"> | ||
<h1> | ||
<a href="/">Whirlwind</a> | ||
</h1> | ||
</div> | ||
<div id="user-menu"> | ||
% if is_logged_in : | ||
${current_user['_id']} : | ||
<a href="/logout">log-out</a> | ||
% else : | ||
<a href="/login">log-in</a> : | ||
<a href="/signup">sign-up</a> | ||
% endif | ||
</div> | ||
<div class="clear"></div> | ||
</div> | ||
</div> |
Oops, something went wrong.