Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
improving | sqlite3 suppr | see MongoEngine/django-mongoengine#65
Browse files Browse the repository at this point in the history
  • Loading branch information
maxperei committed Apr 23, 2017
1 parent e9b0be5 commit 4c97ded
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ ___
- Python 3.5.2
- Django 1.9.1
- PyMongo 3.4.0
- MongoEngine 0.12.0
- MongoEngine 0.12.0

___

`mongod --dbpath /usr/local/mongodb/data/db/`
`python manage.py runserver`
Binary file removed db.sqlite3
Binary file not shown.
31 changes: 21 additions & 10 deletions primoprim/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"""

import os
import sys
import mongoengine

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)

Expand All @@ -28,6 +26,12 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ADMINS = (
('Max Perei', '[email protected]'),
)

MANAGERS = ADMINS

ALLOWED_HOSTS = ['127.0.0.1', 'local.dev', 'localhost']

# Application definition
Expand All @@ -48,6 +52,12 @@
'somnium.apps.SomniumConfig',
]

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -82,7 +92,6 @@

WSGI_APPLICATION = 'primoprim.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

Expand All @@ -98,17 +107,19 @@

DATABASES = {
'default': {
# 'ENGINE': 'django.db.backends.dummy'
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.dummy'
}
}

# AUTHENTICATION_BACKENDS = (
# 'mongoengine.django.auth.MongoEngineBackend',
# )
AUTH_USER_MODEL = 'mongo_auth.MongoUser'

AUTHENTICATION_BACKENDS = (
'django_mongoengine.mongo_auth.backends.MongoEngineBackend',
)

SESSION_ENGINE = 'django_mongoengine.sessions'

#SESSION_ENGINE = 'mongoengine.django.sessions'
SESSION_SERIALIZER = 'django_mongoengine.sessions.BSONSerializer'

# Password validation
# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
Expand Down
5 changes: 4 additions & 1 deletion primoprim/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"""
from django.conf.urls import url, include
from django.contrib import admin
from django_mongoengine import mongo_admin

admin.autodiscover()

urlpatterns = [
url(r'^', include('somnium.urls')),
url(r'^admin/', admin.site.urls),
url(r'^admin/', mongo_admin.site.urls),
]
10 changes: 9 additions & 1 deletion somnium/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
from django.contrib import admin
from django_mongoengine import mongo_admin as admin
from .models import Artist, Performance

# Register your models here.
# @admin.register(Artist)
class ArtistAdmin(admin.DocumentAdmin):
pass

# @admin.register(Performance)
class PerformanceAdmin(admin.DocumentAdmin):
pass
2 changes: 1 addition & 1 deletion somnium/templates/somnium/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

<ul>
{% for artist in artists_list %}
<li><a href="#">{{ artist.name }}</a></li>
<li><a href="#" data-id="{{ artist.id }}">{{ artist.name }}, <em>{{ artist.location }}</em></a></li>
{% endfor %}
</ul>

1 comment on commit 4c97ded

@maxperei
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.