Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions activate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import inspect
from os import path


ROOT = path.dirname(path.abspath(inspect.stack()[0][1]))

filename = path.join(ROOT, '.env/bin/activate_this.py')
try:
execfile(filename, {'__file__': filename})
except:
pass
8 changes: 5 additions & 3 deletions arim/conrad.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import json
import urllib
import urllib2
from django.conf import settings
from os import path
from sys import stderr
from time import sleep

from django.conf import settings
from activate import ROOT


class Conrad(object):
Expand Down Expand Up @@ -164,9 +166,9 @@ def do_request(self, request):
data = request.get_data()
if data:
stderr.write(u' ' + data + u'\n')
with open('error', 'wb') as f:
with open(path.join(ROOT, 'error'), 'wb') as f:
f.write(e.fp.read())
with open('error', 'rb') as f:
with open(path.join(ROOT, 'error'), 'rb') as f:
stderr.write(''.join(
' ' + line + '\n'
for line in f.read().splitlines()))
Expand Down
4 changes: 0 additions & 4 deletions arim/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,3 @@
'django.contrib.auth.backends.ModelBackend',
'django_cas.backends.CASBackend',
)

ROOT = abspath(__file__)
for i in range(3):
ROOT = dirname(ROOT)
3 changes: 3 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import os
import sys

import activate


if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arim.settings")

Expand Down
24 changes: 14 additions & 10 deletions arim/wsgi.py → wsgi.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
"""
WSGI config for arim project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
"""

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""
import inspect
import os
import sys
from os import path


ROOT = path.dirname(path.abspath(inspect.stack()[0][1]))
sys.path.append(ROOT)

from django.conf import settings

import activate

sys.path.append(settings.ROOT)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arim.settings")


from django.conf import settings

settings.DEBUG = settings.TEMPLATE_DEBUG = False


# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
Expand Down