Skip to content

Commit

Permalink
first changes for migration to django 1.8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoch committed Feb 12, 2016
1 parent a45af61 commit 4cb3e54
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 32 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Expand Up @@ -12,16 +12,14 @@ RUN pip install -v scipy
RUN pip install numpy
RUN pip install scikit-learn pandas h5py matplotlib
RUN pip install uwsgi
RUN pip install 'Django>=1.7.1,<1.8'
RUN pip install 'Django==1.8.8'
RUN pip install 'python-social-auth==0.2.7'
RUN pip install djangorestframework
RUN pip install markdown
RUN pip install django-filter
RUN pip install django-taggit
RUN pip install django-form-utils
RUN pip install hamlpy
RUN pip install django-crispy-forms
RUN pip install South
RUN pip install django-taggit-templatetags
RUN pip install django-dirtyfields
RUN pip install 'dropbox==1.6'
Expand Down
2 changes: 1 addition & 1 deletion expdj/apps/experiments/models.py
Expand Up @@ -116,7 +116,7 @@ def __meta__(self):

class Experiment(models.Model):
template = models.ForeignKey(ExperimentTemplate, help_text="Experiment template to be customized by the researcher", verbose_name="Experiment Factory Experiment", null=True, blank=False,on_delete=DO_NOTHING)
credit_conditions = models.ManyToManyField(CreditCondition,related_name="conditions",help_text="functions over performance and rejection variables to allocate payments and credit.",null=True,blank=True)
credit_conditions = models.ManyToManyField(CreditCondition,related_name="conditions",help_text="functions over performance and rejection variables to allocate payments and credit.",blank=True)
include_bonus = models.BooleanField(choices=((False, 'does not include bonus'),
(True, 'includes bonus')),
default=False,verbose_name="Bonus")
Expand Down
1 change: 1 addition & 0 deletions expdj/apps/main/templates/base.html
@@ -1,3 +1,4 @@
{% load static from staticfiles %}
<!DOCTYPE HTML>
<html>
<head>
Expand Down
40 changes: 27 additions & 13 deletions expdj/settings.py
Expand Up @@ -68,7 +68,8 @@
'guardian',
'dbbackup',
'djrill',
'djcelery'
'djcelery',
'rest_framework'
)


Expand Down Expand Up @@ -108,16 +109,23 @@

ROOT_URLCONF = 'expdj.urls'

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
'django.core.context_processors.request',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': (),
'OPTIONS': {'context_processors': ("django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
'django.core.context_processors.request'),
'loaders': ('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)}
}
]

TEST_RUNNER = 'django.test.runner.DiscoverRunner'

Expand Down Expand Up @@ -155,8 +163,6 @@

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'hamlpy.template.loaders.HamlPyFilesystemLoader',
'hamlpy.template.loaders.HamlPyAppDirectoriesLoader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
Expand Down Expand Up @@ -200,6 +206,14 @@

CELERY_TIMEZONE = 'Europe/Berlin'

# REST FRAMEWORK
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}

CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SECURE = False
Expand Down
42 changes: 31 additions & 11 deletions expdj/urls.py
@@ -1,23 +1,43 @@
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls import patterns, include, url
from rest_framework import routers, serializers, viewsets
from django.conf.urls import include, url, patterns
from django.http import Http404, HttpResponse
from django.conf.urls.static import static
from expdj.apps.turk.models import Result
from expdj.apps.main import urls as main_urls
from expdj.apps.turk import urls as turk_urls
from expdj.apps.users import urls as users_urls
from expdj.apps.experiments import urls as experiment_urls
from django.contrib import admin
from django.conf import settings
import os
from django import template
template.add_to_builtins('django.templatetags.future')
template.add_to_builtins('django.contrib.staticfiles.templatetags.staticfiles')

# Serializers define the API representation.
class ResultSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Result
fields = ('taskdata', 'experiment', 'battery', 'worker','language','browser','platform','completed','datetime')

# ViewSets define the view behavior.
class ResultViewSet(viewsets.ModelViewSet):
queryset = Result.objects.all()
serializer_class = ResultSerializer

# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'results', ResultViewSet)

admin.autodiscover()

urlpatterns = patterns('',
url('', include('social.apps.django_app.urls', namespace='social')),
url(r'^accounts/',include('expdj.apps.users.urls')),
url(r'^', include('expdj.apps.main.urls')),
url(r'^', include('expdj.apps.experiments.urls')),
url(r'^', include('expdj.apps.turk.urls')),
url(r'^admin/', include(admin.site.urls)))
urlpatterns = [ url(r'^', include(main_urls)),
url(r'^', include(turk_urls)),
url(r'^', include(experiment_urls)),
url(r'^accounts/', include(users_urls)),
url(r'^', include(router.urls)),
url(r'^api/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^admin/', include(admin.site.urls))
]


if settings.DEBUG:
urlpatterns += patterns(
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
@@ -1,4 +1,4 @@
Django>=1.7.1,<1.8
Django==1.8.8
psycopg2
markdown
matplotlib
Expand All @@ -7,7 +7,6 @@ django-guardian
django-crispy-forms
django-extensions
djangorestframework
hamlpy
django-filter
django-taggit
django-taggit-templatetags
Expand All @@ -25,11 +24,9 @@ dropbox==1.6
kombu
opbeat
djrill
pyyaml
ua-parser
user-agents
django-user-agents
South
django-dirtyfields
cython
h5py
Expand Down
2 changes: 2 additions & 0 deletions run_uwsgi.sh
@@ -1,4 +1,6 @@
#!/bin/bash
python manage.py makemigrations
python manage.py migrate auth
python manage.py migrate
python manage.py collectstatic --noinput
git clone https://github.com/expfactory/expfactory-explorer
Expand Down

0 comments on commit 4cb3e54

Please sign in to comment.