Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Commit

Permalink
Move manage.py and settings.py from edinsights to src directory, and …
Browse files Browse the repository at this point in the history
…adjust some package names.
  • Loading branch information
brianhw committed Nov 13, 2013
1 parent 9a30068 commit 6ac9574
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 51 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Expand Up @@ -9,7 +9,7 @@ To install a development setup:
git clone https://github.com/edx/insights
cd insights
pip install -r requirements.txt
cd src/edinsights/
cd src
python manage.py syncdb
python manage.py migrate
python manage.py runserver localhost:9022
Expand Down
14 changes: 0 additions & 14 deletions src/edinsights/manage.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/edinsights/periodic/tests.py
Expand Up @@ -5,13 +5,13 @@
from django.test import TestCase
from django.test.client import Client
from django.core.cache import cache
from core.decorators import use_clearcache
from edinsights.core.decorators import use_clearcache

def count_timestamps(tempfilename):
with open(tempfile.gettempdir() + '/' + tempfilename, 'r') as temp_file:
timestamps = temp_file.readlines()
ncalls = len(timestamps)
last_call = float(timestamps[-1].rstrip())
last_call = float(timestamps[-1].rstrip()) if ncalls > 0 else None
return ncalls, last_call

def truncate_tempfile(tempfilename):
Expand Down Expand Up @@ -140,4 +140,4 @@ def test_cron_and_memoize_and_view_with_forcememoize(self):

ncalls_after, lastcall_after = count_timestamps('big_computation_withfm_counter')
self.assertEqual(ncalls_before, ncalls_after)
self.assertEqual(lastcall_before, lastcall_after)
self.assertEqual(lastcall_before, lastcall_after)
2 changes: 1 addition & 1 deletion src/edinsights/urls.py
Expand Up @@ -9,7 +9,7 @@
urlpatterns = patterns('',
# Examples:
url(r'^$', 'edinsights.core.views.index'),
url('^', include('core.urls')),
url('^', include('edinsights.core.urls')),
url(r'^httpevent$', 'djeventstream.httphandler.views.http_view'),
# url(r'^view/([A-Za-z_+]+)/([A-Za-z_+]+)$', 'core.views.handle_view'),
# url(r'^view/([A-Za-z_+]+)/([A-Za-z_+]+)/([A-Za-z_0-9]+)$', 'core.views.handle_view'),
Expand Down
10 changes: 10 additions & 0 deletions src/manage.py
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import os
import sys

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

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)
53 changes: 21 additions & 32 deletions src/edinsights/settings.py → src/settings.py
Expand Up @@ -7,8 +7,8 @@
# DJOBJECT_CONFIG = [{}, {'baseurl' : 'http://127.0.0.1:9022/'}]


# Types of parameters that queries and views can take.
# This is not properly used yet.
# Types of parameters that queries and views can take.
# This is not properly used yet.
DJANALYTICS_PARAMETERS = ['user', 'filename', 'key']
DJFS = { 'type' : 'osfs',
'directory_root' : '/tmp/djfsmodule',
Expand All @@ -18,11 +18,14 @@

TIME_BETWEEN_DATA_REGENERATION = datetime.timedelta(minutes=1)

INSTALLED_ANALYTICS_MODULES = ('modules.testmodule',)
INSTALLED_ANALYTICS_MODULES = (
# Add testmodule package here for tests to be able to run.
'edinsights.modules.testmodule',
)

SNS_SUBSCRIPTIONS = []

#### Default Django settings below.
#### Default Django settings below.

DEBUG = True
TEMPLATE_DEBUG = DEBUG
Expand All @@ -34,7 +37,7 @@
MANAGERS = ADMINS

DATABASES = {
'default': {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '../../localdb.sql', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
Expand Down Expand Up @@ -102,7 +105,7 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'core.render.ModuleFileFinder',
'edinsights.core.render.ModuleFileFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

Expand Down Expand Up @@ -134,13 +137,15 @@
# Don't forget to use absolute paths, not relative paths.
)

DJ_REQUIRED_APPS = ( 'djeventstream.httphandler',
DJ_REQUIRED_APPS = (
'djeventstream.httphandler',
'djcelery',
'south',
'core',
'modulefs',
'modules',
'periodic',)
'edinsights.core',
'edinsights.modulefs',
'edinsights.modules',
'edinsights.periodic',
)

INSTALLED_APPS = (
'django.contrib.auth',
Expand Down Expand Up @@ -193,26 +198,10 @@
# 'error', r"DateTimeField received a naive datetime",
# RuntimeWarning, r'django\.db\.models\.fields')

#initialize celery
# initialize celery
import djcelery
djcelery.setup_loader()
#import the settings for celery from the edinsights module and for cache

try:
from celerysettings_dev import *
from djangocachesettings_dev import *
except:
# The code had the imports below. These fail when running test
# cases stand-alone. I think the above fixes this, but I'm
# leaving this in for now in case there are configurations I
# haven't thought of. If the exception is raised, remove this
# comment, remove the exception, and add a comment explaining
# when the second set of imports is necessary.
#
# If it's, say, October, and no one has run into the exception,
# we should kill the extra code.
#
# pmitros -- 21/July/2013.
raise Exception("Import failed. See instructions in settings.py")
from edinsights.djangocachesettings_dev import *
from edinsights.celerysettings_dev import *

# import the settings for celery from the edinsights module and for cache
from edinsights.celerysettings_dev import *
from edinsights.djangocachesettings_dev import *

0 comments on commit 6ac9574

Please sign in to comment.