Commit 86fde4fa009cb73f255739b1d8ca419ad2805e66
1 parent
5453692a81
Exists in
master
Restructured by moving flashy up a dir
Showing 20 changed files with 329 additions and 329 deletions Side-by-side Diff
- flashcards/admin.py
- flashcards/migrations/0001_initial.py
- flashcards/migrations/0002_auto_20150429_0248.py
- flashcards/models.py
- flashcards/tests.py
- flashcards/views.py
- flashy/flashcards/admin.py
- flashy/flashcards/migrations/0001_initial.py
- flashy/flashcards/migrations/0002_auto_20150429_0248.py
- flashy/flashcards/models.py
- flashy/flashcards/tests.py
- flashy/flashcards/views.py
- flashy/flashy/settings.py
- flashy/flashy/urls.py
- flashy/flashy/wsgi.py
- flashy/manage.py
- flashy/settings.py
- flashy/urls.py
- flashy/wsgi.py
- manage.py
flashcards/admin.py
View file @
86fde4f
flashcards/migrations/0001_initial.py
View file @
86fde4f
1 | +# -*- coding: utf-8 -*- | |
2 | +from __future__ import unicode_literals | |
3 | + | |
4 | +from django.db import models, migrations | |
5 | +from django.conf import settings | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.CreateModel( | |
16 | + name='Class', | |
17 | + fields=[ | |
18 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
19 | + ('department', models.CharField(max_length=50)), | |
20 | + ('course_num', models.IntegerField()), | |
21 | + ('name', models.CharField(max_length=50)), | |
22 | + ('professor', models.CharField(max_length=50)), | |
23 | + ('quarter', models.CharField(max_length=4)), | |
24 | + ('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), | |
25 | + ], | |
26 | + ), | |
27 | + migrations.CreateModel( | |
28 | + name='Flashcard', | |
29 | + fields=[ | |
30 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
31 | + ('text', models.CharField(max_length=255)), | |
32 | + ('pushed', models.DateTimeField()), | |
33 | + ('material_date', models.DateTimeField()), | |
34 | + ('hidden', models.CharField(max_length=255, null=True, blank=True)), | |
35 | + ('associated_class', models.ForeignKey(to='flashcards.Class')), | |
36 | + ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
37 | + ], | |
38 | + ), | |
39 | + migrations.CreateModel( | |
40 | + name='FlashcardMask', | |
41 | + fields=[ | |
42 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
43 | + ('ranges', models.CharField(max_length=255)), | |
44 | + ], | |
45 | + ), | |
46 | + migrations.CreateModel( | |
47 | + name='UserFlashcard', | |
48 | + fields=[ | |
49 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
50 | + ('pulled', models.DateTimeField(null=True)), | |
51 | + ('unpulled', models.DateTimeField(null=True)), | |
52 | + ('flashcard', models.ForeignKey(to='flashcards.Flashcard')), | |
53 | + ('mask', models.ForeignKey(to='flashcards.FlashcardMask')), | |
54 | + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
55 | + ], | |
56 | + ), | |
57 | + migrations.CreateModel( | |
58 | + name='UserFlashCardReview', | |
59 | + fields=[ | |
60 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
61 | + ('when', models.DateTimeField()), | |
62 | + ('blanked_word', models.CharField(max_length=8)), | |
63 | + ('response', models.CharField(max_length=255, null=True, blank=True)), | |
64 | + ('correct', models.NullBooleanField()), | |
65 | + ('user_flashcard', models.ForeignKey(to='flashcards.UserFlashcard')), | |
66 | + ], | |
67 | + ), | |
68 | + migrations.AddField( | |
69 | + model_name='flashcard', | |
70 | + name='mask', | |
71 | + field=models.ForeignKey(to='flashcards.FlashcardMask', null=True), | |
72 | + ), | |
73 | + migrations.AddField( | |
74 | + model_name='flashcard', | |
75 | + name='previous', | |
76 | + field=models.ForeignKey(to='flashcards.Flashcard', null=True), | |
77 | + ), | |
78 | + ] |
flashcards/migrations/0002_auto_20150429_0248.py
View file @
86fde4f
1 | +# -*- coding: utf-8 -*- | |
2 | +from __future__ import unicode_literals | |
3 | + | |
4 | +from django.db import models, migrations | |
5 | + | |
6 | + | |
7 | +class Migration(migrations.Migration): | |
8 | + | |
9 | + dependencies = [ | |
10 | + ('flashcards', '0001_initial'), | |
11 | + ] | |
12 | + | |
13 | + operations = [ | |
14 | + migrations.AlterModelOptions( | |
15 | + name='userflashcard', | |
16 | + options={'ordering': ['-pulled']}, | |
17 | + ), | |
18 | + migrations.AlterUniqueTogether( | |
19 | + name='userflashcard', | |
20 | + unique_together=set([('user', 'flashcard')]), | |
21 | + ), | |
22 | + migrations.AlterIndexTogether( | |
23 | + name='userflashcard', | |
24 | + index_together=set([('user', 'flashcard')]), | |
25 | + ), | |
26 | + ] |
flashcards/models.py
View file @
86fde4f
1 | +from django.contrib.auth.models import User | |
2 | +from django.db import models | |
3 | + | |
4 | + | |
5 | +class UserFlashcard(models.Model): | |
6 | + """ | |
7 | + Represents the relationship between a user and a flashcard by: | |
8 | + 1. A user has a flashcard in their deck | |
9 | + 2. A user used to have a flashcard in their deck | |
10 | + 3. A user has a flashcard hidden from them | |
11 | + """ | |
12 | + user = models.ForeignKey(User) | |
13 | + mask = models.ForeignKey('FlashcardMask') | |
14 | + pulled = models.DateTimeField(null=True) | |
15 | + flashcard = models.ForeignKey('Flashcard') | |
16 | + unpulled = models.DateTimeField(null=True) | |
17 | + | |
18 | + class Meta: | |
19 | + unique_together = (('user', 'flashcard'),) | |
20 | + index_together = ["user", "flashcard"] | |
21 | + ordering = ['-pulled'] | |
22 | + | |
23 | + def is_hidden(self): | |
24 | + return not self.pulled | |
25 | + | |
26 | + def is_active(self): | |
27 | + return self.pulled and not self.unpulled | |
28 | + | |
29 | + | |
30 | +class FlashcardMask(models.Model): | |
31 | + ranges = models.CharField(max_length=255) | |
32 | + | |
33 | + | |
34 | +class Flashcard(models.Model): | |
35 | + text = models.CharField(max_length=255) | |
36 | + associated_class = models.ForeignKey('Class') | |
37 | + pushed = models.DateTimeField() | |
38 | + material_date = models.DateTimeField() | |
39 | + previous = models.ForeignKey('Flashcard', null=True) | |
40 | + author = models.ForeignKey(User) | |
41 | + hidden = models.CharField(null=True, blank=True, max_length=255) | |
42 | + mask = models.ForeignKey(FlashcardMask, null=True) | |
43 | + | |
44 | + def is_visible_to(self, user): | |
45 | + result = self.userflashcard_set.filter(user=user) | |
46 | + | |
47 | + @classmethod | |
48 | + def cards_visible_to(cls, user): | |
49 | + return cls.objects.filter(hidden=False).exclude(userflashcard=user, | |
50 | + userflashcard__pulled=None) | |
51 | + | |
52 | + | |
53 | +class UserFlashcardReview(models.Model): | |
54 | + user_flashcard = models.ForeignKey(UserFlashcard) | |
55 | + when = models.DateTimeField() | |
56 | + blanked_word = models.CharField(max_length=8) | |
57 | + response = models.CharField(max_length=255, blank=True, null=True) | |
58 | + correct = models.NullBooleanField() | |
59 | + | |
60 | + | |
61 | +class Class(models.Model): | |
62 | + department = models.CharField(max_length=50) | |
63 | + course_num = models.IntegerField() | |
64 | + name = models.CharField(max_length=50) | |
65 | + professor = models.CharField(max_length=50) | |
66 | + quarter = models.CharField(max_length=4) | |
67 | + members = models.ManyToManyField(User) |
flashcards/tests.py
View file @
86fde4f
flashcards/views.py
View file @
86fde4f
flashy/flashcards/admin.py
View file @
86fde4f
flashy/flashcards/migrations/0001_initial.py
View file @
86fde4f
1 | -# -*- coding: utf-8 -*- | |
2 | -from __future__ import unicode_literals | |
3 | - | |
4 | -from django.db import models, migrations | |
5 | -from django.conf import settings | |
6 | - | |
7 | - | |
8 | -class Migration(migrations.Migration): | |
9 | - | |
10 | - dependencies = [ | |
11 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
12 | - ] | |
13 | - | |
14 | - operations = [ | |
15 | - migrations.CreateModel( | |
16 | - name='Class', | |
17 | - fields=[ | |
18 | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
19 | - ('department', models.CharField(max_length=50)), | |
20 | - ('course_num', models.IntegerField()), | |
21 | - ('name', models.CharField(max_length=50)), | |
22 | - ('professor', models.CharField(max_length=50)), | |
23 | - ('quarter', models.CharField(max_length=4)), | |
24 | - ('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), | |
25 | - ], | |
26 | - ), | |
27 | - migrations.CreateModel( | |
28 | - name='Flashcard', | |
29 | - fields=[ | |
30 | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
31 | - ('text', models.CharField(max_length=255)), | |
32 | - ('pushed', models.DateTimeField()), | |
33 | - ('material_date', models.DateTimeField()), | |
34 | - ('hidden', models.CharField(max_length=255, null=True, blank=True)), | |
35 | - ('associated_class', models.ForeignKey(to='flashcards.Class')), | |
36 | - ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
37 | - ], | |
38 | - ), | |
39 | - migrations.CreateModel( | |
40 | - name='FlashcardMask', | |
41 | - fields=[ | |
42 | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
43 | - ('ranges', models.CharField(max_length=255)), | |
44 | - ], | |
45 | - ), | |
46 | - migrations.CreateModel( | |
47 | - name='UserFlashcard', | |
48 | - fields=[ | |
49 | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
50 | - ('pulled', models.DateTimeField(null=True)), | |
51 | - ('unpulled', models.DateTimeField(null=True)), | |
52 | - ('flashcard', models.ForeignKey(to='flashcards.Flashcard')), | |
53 | - ('mask', models.ForeignKey(to='flashcards.FlashcardMask')), | |
54 | - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), | |
55 | - ], | |
56 | - ), | |
57 | - migrations.CreateModel( | |
58 | - name='UserFlashCardReview', | |
59 | - fields=[ | |
60 | - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
61 | - ('when', models.DateTimeField()), | |
62 | - ('blanked_word', models.CharField(max_length=8)), | |
63 | - ('response', models.CharField(max_length=255, null=True, blank=True)), | |
64 | - ('correct', models.NullBooleanField()), | |
65 | - ('user_flashcard', models.ForeignKey(to='flashcards.UserFlashcard')), | |
66 | - ], | |
67 | - ), | |
68 | - migrations.AddField( | |
69 | - model_name='flashcard', | |
70 | - name='mask', | |
71 | - field=models.ForeignKey(to='flashcards.FlashcardMask', null=True), | |
72 | - ), | |
73 | - migrations.AddField( | |
74 | - model_name='flashcard', | |
75 | - name='previous', | |
76 | - field=models.ForeignKey(to='flashcards.Flashcard', null=True), | |
77 | - ), | |
78 | - ] |
flashy/flashcards/migrations/0002_auto_20150429_0248.py
View file @
86fde4f
1 | -# -*- coding: utf-8 -*- | |
2 | -from __future__ import unicode_literals | |
3 | - | |
4 | -from django.db import models, migrations | |
5 | - | |
6 | - | |
7 | -class Migration(migrations.Migration): | |
8 | - | |
9 | - dependencies = [ | |
10 | - ('flashcards', '0001_initial'), | |
11 | - ] | |
12 | - | |
13 | - operations = [ | |
14 | - migrations.AlterModelOptions( | |
15 | - name='userflashcard', | |
16 | - options={'ordering': ['-pulled']}, | |
17 | - ), | |
18 | - migrations.AlterUniqueTogether( | |
19 | - name='userflashcard', | |
20 | - unique_together=set([('user', 'flashcard')]), | |
21 | - ), | |
22 | - migrations.AlterIndexTogether( | |
23 | - name='userflashcard', | |
24 | - index_together=set([('user', 'flashcard')]), | |
25 | - ), | |
26 | - ] |
flashy/flashcards/models.py
View file @
86fde4f
1 | -from django.contrib.auth.models import User | |
2 | -from django.db import models | |
3 | - | |
4 | - | |
5 | -class UserFlashcard(models.Model): | |
6 | - """ | |
7 | - Represents the relationship between a user and a flashcard by: | |
8 | - 1. A user has a flashcard in their deck | |
9 | - 2. A user used to have a flashcard in their deck | |
10 | - 3. A user has a flashcard hidden from them | |
11 | - """ | |
12 | - user = models.ForeignKey(User) | |
13 | - mask = models.ForeignKey('FlashcardMask') | |
14 | - pulled = models.DateTimeField(null=True) | |
15 | - flashcard = models.ForeignKey('Flashcard') | |
16 | - unpulled = models.DateTimeField(null=True) | |
17 | - | |
18 | - class Meta: | |
19 | - unique_together = (('user', 'flashcard'),) | |
20 | - index_together = ["user", "flashcard"] | |
21 | - ordering = ['-pulled'] | |
22 | - | |
23 | - def is_hidden(self): | |
24 | - return not self.pulled | |
25 | - | |
26 | - def is_active(self): | |
27 | - return self.pulled and not self.unpulled | |
28 | - | |
29 | - | |
30 | -class FlashcardMask(models.Model): | |
31 | - ranges = models.CharField(max_length=255) | |
32 | - | |
33 | - | |
34 | -class Flashcard(models.Model): | |
35 | - text = models.CharField(max_length=255) | |
36 | - associated_class = models.ForeignKey('Class') | |
37 | - pushed = models.DateTimeField() | |
38 | - material_date = models.DateTimeField() | |
39 | - previous = models.ForeignKey('Flashcard', null=True) | |
40 | - author = models.ForeignKey(User) | |
41 | - hidden = models.CharField(null=True, blank=True, max_length=255) | |
42 | - mask = models.ForeignKey(FlashcardMask, null=True) | |
43 | - | |
44 | - def is_visible_to(self, user): | |
45 | - result = self.userflashcard_set.filter(user=user) | |
46 | - | |
47 | - @classmethod | |
48 | - def cards_visible_to(cls, user): | |
49 | - return cls.objects.filter(hidden=False).exclude(userflashcard=user, | |
50 | - userflashcard__pulled=None) | |
51 | - | |
52 | - | |
53 | -class UserFlashcardReview(models.Model): | |
54 | - user_flashcard = models.ForeignKey(UserFlashcard) | |
55 | - when = models.DateTimeField() | |
56 | - blanked_word = models.CharField(max_length=8) | |
57 | - response = models.CharField(max_length=255, blank=True, null=True) | |
58 | - correct = models.NullBooleanField() | |
59 | - | |
60 | - | |
61 | -class Class(models.Model): | |
62 | - department = models.CharField(max_length=50) | |
63 | - course_num = models.IntegerField() | |
64 | - name = models.CharField(max_length=50) | |
65 | - professor = models.CharField(max_length=50) | |
66 | - quarter = models.CharField(max_length=4) | |
67 | - members = models.ManyToManyField(User) |
flashy/flashcards/tests.py
View file @
86fde4f
flashy/flashcards/views.py
View file @
86fde4f
flashy/flashy/settings.py
View file @
86fde4f
1 | -""" | |
2 | -Django settings for flashy project. | |
3 | - | |
4 | -Generated by 'django-admin startproject' using Django 1.8. | |
5 | - | |
6 | -For more information on this file, see | |
7 | -https://docs.djangoproject.com/en/1.8/topics/settings/ | |
8 | - | |
9 | -For the full list of settings and their values, see | |
10 | -https://docs.djangoproject.com/en/1.8/ref/settings/ | |
11 | -""" | |
12 | - | |
13 | -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
14 | -import os | |
15 | - | |
16 | -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
17 | - | |
18 | - | |
19 | -# Quick-start development settings - unsuitable for production | |
20 | -# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ | |
21 | - | |
22 | -# SECURITY WARNING: keep the secret key used in production secret! | |
23 | -SECRET_KEY = '8)#-j&8dghe-y&v4a%r6u#y@r86&6nfv%k$(a((r-zh$m3ct!9' | |
24 | - | |
25 | -# SECURITY WARNING: don't run with debug turned on in production! | |
26 | -DEBUG = True | |
27 | - | |
28 | -ALLOWED_HOSTS = [] | |
29 | - | |
30 | - | |
31 | -# Application definition | |
32 | - | |
33 | -INSTALLED_APPS = ( | |
34 | - 'django.contrib.admin', | |
35 | - 'django.contrib.auth', | |
36 | - 'django.contrib.contenttypes', | |
37 | - 'django.contrib.sessions', | |
38 | - 'django.contrib.messages', | |
39 | - 'django.contrib.staticfiles', | |
40 | - 'rest_framework', | |
41 | - 'flashcards', | |
42 | -) | |
43 | - | |
44 | -MIDDLEWARE_CLASSES = ( | |
45 | - 'django.contrib.sessions.middleware.SessionMiddleware', | |
46 | - 'django.middleware.common.CommonMiddleware', | |
47 | - 'django.middleware.csrf.CsrfViewMiddleware', | |
48 | - 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
49 | - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
50 | - 'django.contrib.messages.middleware.MessageMiddleware', | |
51 | - 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
52 | - 'django.middleware.security.SecurityMiddleware', | |
53 | -) | |
54 | - | |
55 | -ROOT_URLCONF = 'flashy.urls' | |
56 | - | |
57 | -TEMPLATES = [ | |
58 | - { | |
59 | - 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
60 | - 'DIRS': [], | |
61 | - 'APP_DIRS': True, | |
62 | - 'OPTIONS': { | |
63 | - 'context_processors': [ | |
64 | - 'django.template.context_processors.debug', | |
65 | - 'django.template.context_processors.request', | |
66 | - 'django.contrib.auth.context_processors.auth', | |
67 | - 'django.contrib.messages.context_processors.messages', | |
68 | - ], | |
69 | - }, | |
70 | - }, | |
71 | -] | |
72 | - | |
73 | -WSGI_APPLICATION = 'flashy.wsgi.application' | |
74 | - | |
75 | - | |
76 | -# Database | |
77 | -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases | |
78 | - | |
79 | -DATABASES = { | |
80 | - 'default': { | |
81 | - 'ENGINE': 'django.db.backends.sqlite3', | |
82 | - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
83 | - } | |
84 | -} | |
85 | - | |
86 | - | |
87 | -# Internationalization | |
88 | -# https://docs.djangoproject.com/en/1.8/topics/i18n/ | |
89 | - | |
90 | -LANGUAGE_CODE = 'en-us' | |
91 | - | |
92 | -TIME_ZONE = 'UTC' | |
93 | - | |
94 | -USE_I18N = True | |
95 | - | |
96 | -USE_L10N = True | |
97 | - | |
98 | -USE_TZ = True | |
99 | - | |
100 | - | |
101 | -# Static files (CSS, JavaScript, Images) | |
102 | -# https://docs.djangoproject.com/en/1.8/howto/static-files/ | |
103 | - | |
104 | -STATIC_URL = '/static/' |
flashy/flashy/urls.py
View file @
86fde4f
1 | -from django.conf.urls import include, url | |
2 | -from django.contrib import admin | |
3 | - | |
4 | -urlpatterns = [ | |
5 | - # Examples: | |
6 | - # url(r'^$', 'flashy.views.home', name='home'), | |
7 | - # url(r'^blog/', include('blog.urls')), | |
8 | - | |
9 | - url(r'^admin/', include(admin.site.urls)), | |
10 | - url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) | |
11 | -] |
flashy/flashy/wsgi.py
View file @
86fde4f
1 | -""" | |
2 | -WSGI config for flashy project. | |
3 | - | |
4 | -It exposes the WSGI callable as a module-level variable named ``application``. | |
5 | - | |
6 | -For more information on this file, see | |
7 | -https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ | |
8 | -""" | |
9 | - | |
10 | -import os | |
11 | - | |
12 | -from django.core.wsgi import get_wsgi_application | |
13 | - | |
14 | -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flashy.settings") | |
15 | - | |
16 | -application = get_wsgi_application() |
flashy/manage.py
View file @
86fde4f
flashy/settings.py
View file @
86fde4f
1 | +""" | |
2 | +Django settings for flashy project. | |
3 | + | |
4 | +Generated by 'django-admin startproject' using Django 1.8. | |
5 | + | |
6 | +For more information on this file, see | |
7 | +https://docs.djangoproject.com/en/1.8/topics/settings/ | |
8 | + | |
9 | +For the full list of settings and their values, see | |
10 | +https://docs.djangoproject.com/en/1.8/ref/settings/ | |
11 | +""" | |
12 | + | |
13 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | |
14 | +import os | |
15 | + | |
16 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
17 | + | |
18 | + | |
19 | +# Quick-start development settings - unsuitable for production | |
20 | +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ | |
21 | + | |
22 | +# SECURITY WARNING: keep the secret key used in production secret! | |
23 | +SECRET_KEY = '8)#-j&8dghe-y&v4a%r6u#y@r86&6nfv%k$(a((r-zh$m3ct!9' | |
24 | + | |
25 | +# SECURITY WARNING: don't run with debug turned on in production! | |
26 | +DEBUG = True | |
27 | + | |
28 | +ALLOWED_HOSTS = [] | |
29 | + | |
30 | + | |
31 | +# Application definition | |
32 | + | |
33 | +INSTALLED_APPS = ( | |
34 | + 'django.contrib.admin', | |
35 | + 'django.contrib.auth', | |
36 | + 'django.contrib.contenttypes', | |
37 | + 'django.contrib.sessions', | |
38 | + 'django.contrib.messages', | |
39 | + 'django.contrib.staticfiles', | |
40 | + 'rest_framework', | |
41 | + 'flashcards', | |
42 | +) | |
43 | + | |
44 | +MIDDLEWARE_CLASSES = ( | |
45 | + 'django.contrib.sessions.middleware.SessionMiddleware', | |
46 | + 'django.middleware.common.CommonMiddleware', | |
47 | + 'django.middleware.csrf.CsrfViewMiddleware', | |
48 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
49 | + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', | |
50 | + 'django.contrib.messages.middleware.MessageMiddleware', | |
51 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
52 | + 'django.middleware.security.SecurityMiddleware', | |
53 | +) | |
54 | + | |
55 | +ROOT_URLCONF = 'flashy.urls' | |
56 | + | |
57 | +TEMPLATES = [ | |
58 | + { | |
59 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', | |
60 | + 'DIRS': [], | |
61 | + 'APP_DIRS': True, | |
62 | + 'OPTIONS': { | |
63 | + 'context_processors': [ | |
64 | + 'django.template.context_processors.debug', | |
65 | + 'django.template.context_processors.request', | |
66 | + 'django.contrib.auth.context_processors.auth', | |
67 | + 'django.contrib.messages.context_processors.messages', | |
68 | + ], | |
69 | + }, | |
70 | + }, | |
71 | +] | |
72 | + | |
73 | +WSGI_APPLICATION = 'flashy-backend.wsgi.application' | |
74 | + | |
75 | + | |
76 | +# Database | |
77 | +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases | |
78 | + | |
79 | +DATABASES = { | |
80 | + 'default': { | |
81 | + 'ENGINE': 'django.db.backends.sqlite3', | |
82 | + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | |
83 | + } | |
84 | +} | |
85 | + | |
86 | + | |
87 | +# Internationalization | |
88 | +# https://docs.djangoproject.com/en/1.8/topics/i18n/ | |
89 | + | |
90 | +LANGUAGE_CODE = 'en-us' | |
91 | + | |
92 | +TIME_ZONE = 'UTC' | |
93 | + | |
94 | +USE_I18N = True | |
95 | + | |
96 | +USE_L10N = True | |
97 | + | |
98 | +USE_TZ = True | |
99 | + | |
100 | + | |
101 | +# Static files (CSS, JavaScript, Images) | |
102 | +# https://docs.djangoproject.com/en/1.8/howto/static-files/ | |
103 | + | |
104 | +STATIC_URL = '/static/' |
flashy/urls.py
View file @
86fde4f
1 | +from django.conf.urls import include, url | |
2 | +from django.contrib import admin | |
3 | + | |
4 | +urlpatterns = [ | |
5 | + # Examples: | |
6 | + # url(r'^$', 'flashy-backend.views.home', name='home'), | |
7 | + # url(r'^blog/', include('blog.urls')), | |
8 | + | |
9 | + url(r'^admin/', include(admin.site.urls)), | |
10 | + url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')) | |
11 | +] |
flashy/wsgi.py
View file @
86fde4f
1 | +""" | |
2 | +WSGI config for flashy project. | |
3 | + | |
4 | +It exposes the WSGI callable as a module-level variable named ``application``. | |
5 | + | |
6 | +For more information on this file, see | |
7 | +https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ | |
8 | +""" | |
9 | + | |
10 | +import os | |
11 | + | |
12 | +from django.core.wsgi import get_wsgi_application | |
13 | + | |
14 | +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flashy-backend.settings") | |
15 | + | |
16 | +application = get_wsgi_application() |
manage.py
View file @
86fde4f