Commit 62d361a3 authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Initial changes to make fod django 1.4 compliant

parent 5af3efa3
Copyright © 2011-2013 Greek Research and Technology Network (GRNET S.A.)
Developed by Leonidas Poulopoulos (leopoul-at-noc-dot-grnet-dot-gr),
GRNET NOC
Copyright © 2011-2014 Greek Research and Technology Network (GRNET S.A.)
Copyright © 2011-2014 Leonidas Poulopoulos (@leopoul)
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
SOFTWARE.
\ No newline at end of file
......@@ -4,7 +4,7 @@ CELERYD_NODES="w1"
#CELERYD_NODES="w1 w2 w3"
# Where to chdir at start.
CELERYD_CHDIR="/home/leopoul/projects/flowspy/"
CELERYD_CHDIR="/home/to/projects/flowspy/"
# How to call "manage.py celeryd_multi"
CELERYD_MULTI="$CELERYD_CHDIR/manage.py celeryd_multi"
......@@ -22,7 +22,7 @@ CELERYD_LOG_FILE="$CELERYD_CHDIR/celery_var/log/celery/%n.log"
CELERYD_PID_FILE="$CELERYD_CHDIR/celery_var/run/celery/%n.pid"
# Workers should run as an unprivileged user.
CELERYD_USER="leopoul"
CELERYD_USER="user"
CELERYD_GROUP="developers"
# Name of the projects settings module.
......
CONFIG = {
'mode': 'django',
'working_dir': '/home/leopoul/projects/flowspy',
'working_dir': '/home/to/projects/flowspy',
#'python': '/usr/bin/python',
'args': (
'--bind=127.0.0.1:8081',
......
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
execute_manager(settings)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flowspy.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
An example of AJAX chat taken from Tornado demos and converted to use django and gevent.
To start the server, run
$ python run.py
#!/bin/sh
# see http://projects.unbit.it/uwsgi and http://projects.unbit.it/uwsgi/wiki/Gevent
exec uwsgi --loop gevent --http-socket :8000 --module application --async 1000
......@@ -13,7 +13,8 @@
}
html {
height: 100% color: black;
height: 100%;
color: black;
}
#page_wrapper {
......
......@@ -241,7 +241,7 @@
</legend>
<div class="control-group {% if form.source.errors %} error {% endif %}">
<label class="control-label" for="id_source"><b>{% trans "Source Address" %}</b></label>
<div class="controls">{{ form.source }}&nbsp;<img src="/fodstatic/threat_source.png" style="height: 30px;"/>&nbsp;&nbsp;<a class="btn btn-small btn-info" id="setFromAll" href="#">Any</a>
<div class="controls">{{ form.source }}&nbsp;<img src="{{STATIC_URL}}threat_source.png" style="height: 30px;"/>&nbsp;&nbsp;<a class="btn btn-small btn-info" id="setFromAll" href="#">Any</a>
{% if form.source.errors %}
<span class="help-inline">
{{ form.source.errors|join:", " }}
......@@ -255,7 +255,7 @@
<div class="control-group {% if form.destination.errors %} error {% endif %}">
<label class="control-label" for="id_destination"><b>{% trans "Destination Address" %}</b></label>
<div class="controls">
{{ form.destination }}&nbsp;<img src="/fodstatic/secure_destination.png" style="height: 30px;"/>
{{ form.destination }}&nbsp;<img src="{{STATIC_URL}}secure_destination.png" style="height: 30px;"/>
{% if form.destination.errors %}
<span class="help-inline">
{{ form.destination.errors|join:", " }}
......
......@@ -5,17 +5,17 @@
<title>GRNET's FoD :: {% block title %}{% endblock %} </title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
<link REL="SHORTCUT ICON" HREF="/fodstatic/favicon.ico">
<script src="/fodstatic/js/jquery.min.js" type="text/javascript"></script>
<script src="/fodstatic/js/jquery_csrf_protect.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/fodstatic/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/fodstatic/css/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="/fodstatic/css/smoothness/jquery-ui-1.8.13.custom.css">
<link rel="stylesheet" type="text/css" href="/fodstatic/css/base.css">
<link REL="SHORTCUT ICON" HREF="{{STATIC_URL}}favicon.ico">
<script src="{{STATIC_URL}}js/jquery.min.js" type="text/javascript"></script>
<script src="{{STATIC_URL}}js/jquery_csrf_protect.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}css/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}css/smoothness/jquery-ui-1.8.13.custom.css">
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}css/base.css">
<script type="text/javascript" src="/fodstatic/js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="/fodstatic/js/jquery.cookie.js"></script>
<script type="text/javascript" src="/fodstatic/js/bootstrap.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.cookie.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/bootstrap.js"></script>
<script type="text/javascript">
function setlang(lang){
......@@ -47,7 +47,7 @@ body {
{% comment %}
<div id="header">
<a class="grnetlogo" href="{% url group-routes %}">
<img class="logoimg" src="/fodstatic/logo.png">
<img class="logoimg" src="{{STATIC_URL}}logo.png">
</a>
<div id="title">
<a href="{% url group-routes %}">Firewall on Demand</a>
......@@ -94,7 +94,7 @@ body {
<div class="container">
{% block topmenu %}
<a class="brand brandimg" href="{% url group-routes %}"><img src="/fodstatic/img/fod_logo.png" /></a>
<a class="brand brandimg" href="{% url group-routes %}"><img src="{{STATIC_URL}}img/fod_logo.png" /></a>
<ul class="nav">
{% if user.is_authenticated %}
......
......@@ -15,7 +15,7 @@
.headtitle {font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px; }
</style>
<script type="text/javascript" src="/fodstatic/js/jquery.min.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.min.js"></script>
<script type="text/javascript">
......
......@@ -6,7 +6,7 @@
<p>{% trans "If you have any questions or need help, contact GRNET Helpdesk at <a href='mailto:helpdesk@grnet.gr'>helpdesk@grnet.gr</a> or 800-11-47638." %}</p>
{% endif %}
<div style="padding-top: 10px;"><a href="https://code.grnet.gr/projects/flowspy">Vesrion: <strong>{{VERSION}}</strong></a> - {% trans "Designed and developed by GRNET NOC" %}
<a href="//facebook.com/noc.grnet.gr" target="_blank"><img src="/fodstatic/img/facebook_img.png" alt="GRNET NOC on Facebook" title="GRNET NOC on Facebook"/></a> <a href="//twitter.com/grnetnoc" target="_blank"><img src="/fodstatic/img/twitter_img.png" alt="GRNET NOC on Twitter" title="GRNET NOC on Twitter"/></a>
<a href="//facebook.com/noc.grnet.gr" target="_blank"><img src="{{STATIC_URL}}img/facebook_img.png" alt="GRNET NOC on Facebook" title="GRNET NOC on Facebook"/></a> <a href="//twitter.com/grnetnoc" target="_blank"><img src="{{STATIC_URL}}img/twitter_img.png" alt="GRNET NOC on Twitter" title="GRNET NOC on Twitter"/></a>
</div>
<div class="row"><a href="http://noc.grnet.gr">{% trans "GRNET" %} NOC</a> | <a href="/fod/info/{{LANGUAGE_CODE}}/">{% trans "Info" %}</a> | <a href="/fod/tos/{{LANGUAGE_CODE}}/">{% trans "Service Terms" %}</a></div>
<div style="padding-top: 10px;">
......
......@@ -6,8 +6,8 @@
<script type="text/javascript" src="/fodstatic/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="/fodstatic/js/datatables_bootstrap.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.dataTables.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/datatables_bootstrap.js"></script>
<style>
.tab-content {
......@@ -237,7 +237,7 @@ oTableI.fnDraw();
{% endifequal %}
{% endifequal %}
{% endifequal %}"
{% endif %}>{% trans "Rule expired" %}</span>{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Suspended by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Suspended by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="/fodstatic/dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}
{% endif %}>{% trans "Rule expired" %}</span>{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Suspended by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Suspended by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="{{STATIC_URL}}dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}
</td>
</tr>
......
......@@ -32,10 +32,7 @@
<div class="control-group">
<div class="controls">
<button type="submit" id="applybutton" value="Apply"
class="btn btn-primary" />
{% trans "Apply" %}
</button>
<button type="submit" id="applybutton" value="Apply" class="btn btn-primary" />{% trans "Apply" %}</button>
</div>
</div>
</form>
......
......@@ -4,8 +4,8 @@
{% if user.is_authenticated %}
<script type="text/javascript" src="{% url load-js 'poller' %}"></script>
{% endif %}
<script type="text/javascript" src="/fodstatic/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="/fodstatic/js/datatables_bootstrap.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/jquery.dataTables.js"></script>
<script type="text/javascript" src="{{STATIC_URL}}js/datatables_bootstrap.js"></script>
<script type="text/javascript">
......@@ -306,7 +306,7 @@ function delete_route(route){
{% endifequal %}
{% endifequal %}
{% endifequal %}"
{% endif %}>{% trans "Rule expired" %}</span>{% else %}{% if route.status == 'OUTOFSYNC' %}{% trans 'Syncronization error. Configuration in device differs from rule' %}{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Deactivated by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Deactivated by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="/fodstatic/dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}</td>
{% endif %}>{% trans "Rule expired" %}</span>{% else %}{% if route.status == 'OUTOFSYNC' %}{% trans 'Syncronization error. Configuration in device differs from rule' %}{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Deactivated by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Deactivated by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="{{STATIC_URL}}dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}</td>
<td style="text-align: center; width:180px;">
{% ifequal route.status 'ACTIVE' %}
......
......@@ -13,8 +13,8 @@
</div>
<div class="row-fluid">
<div class="span4 well"><h3>{% trans "What" %}?</h3><hr>
<p>{% blocktrans %}If you are new to the service, take some time to read the{% endblocktrans %} <a href="/fod/info/{{LANGUAGE_CODE}}/">{% trans "Service Description" %}</a></p>
<p>{% blocktrans %}Before asking why? take some time to look at the{% endblocktrans %} <a href="/fod/tos/{{LANGUAGE_CODE}}/">{% trans "Service Terms" %}</a></p>
<p>{% blocktrans %}If you are new to the service, take some time to read the{% endblocktrans %} <a href="/info/{{LANGUAGE_CODE}}/">{% trans "Service Description" %}</a></p>
<p>{% blocktrans %}Before asking why? take some time to look at the{% endblocktrans %} <a href="/tos/{{LANGUAGE_CODE}}/">{% trans "Service Terms" %}</a></p>
</div>
<div class="span4 well"><h3>{% trans "How" %}?</h3><hr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment