Permalink
Browse files

improve project structure

  • Loading branch information...
1 parent a6c2172 commit 5dc52d70ab384192c18f15e57f2d79b4c5189c6c Andrii Pryz committed Mar 8, 2014
View
@@ -3,7 +3,9 @@ run:
@echo "--------------------------------------"
@echo "python3 manage.py runserver --nostatic"
@echo "======================================"
- @python3 manage.py runserver --nostatic
+# @python3 manage.py runserver --settings=mysmile.settings.local --nostatic
+# @python3 manage.py runserver --settings=mysmile.settings.local
+ @python3 manage.py runserver
# help - Display callable targets.
help:
View
No changes.
View
@@ -7,8 +7,7 @@
from django.core.exceptions import FieldError
from apps.pages.models import Page, Page_translation
-from mysmile.user_settings import user_settings
-from mysmile.settings import LANGUAGES
+from mysmile.settings.base import LANGUAGES, app_settings
class MySmileApi(View):
@@ -37,9 +36,9 @@ def response_data(self, lang, slug):
response_data['data'] = list(Page_translation.objects.filter(lang=self.lang, page__status=1).values_list('name', flat=True))
elif slug == 'contact':
- response_data['data'] = {'email':user_settings['EMAIL'],
- 'phone':user_settings['PHONE'],
- 'skype':user_settings['SKYPE']
+ response_data['data'] = {'email': app_settings['EMAIL'],
+ 'phone': app_settings['PHONE'],
+ 'skype': app_settings['SKYPE']
}
elif slug == 'language':
@@ -86,9 +85,9 @@ def response_data_short(self, resource):
if resource == 'contact':
try:
- response_data['data'] = {'email':user_settings['EMAIL'],
- 'phone':user_settings['PHONE'],
- 'skype':user_settings['SKYPE']
+ response_data['data'] = {'email': app_settings['EMAIL'],
+ 'phone': app_settings['PHONE'],
+ 'skype': app_settings['SKYPE']
}
except KeyError:
response_data['code'] = 500
View
@@ -1,7 +1,7 @@
import os
from django.contrib import admin
-from mysmile.settings import MEDIA_URL, STATIC_URL, LANGUAGES
+from mysmile.settings.base import MEDIA_URL, STATIC_URL, LANGUAGES
from apps.pages.models import Page, Page_translation
from apps.pages.forms import Page_translationForm
View
@@ -2,8 +2,7 @@
from django.http import Http404
from apps.pages.managers import PagesManager
-from mysmile.settings import LANGUAGES
-from mysmile.user_settings import user_settings
+from mysmile.settings.base import LANGUAGES, app_settings
def ls_check(view_func):
@@ -26,7 +25,7 @@ def _wrapped_view_func(request, *args, **kwargs):
lang = LANGUAGES[0][0]
else:
lang = LANGUAGES[0][0]
- return http.HttpResponseRedirect(user_settings['DOMAIN_NAME'] +
+ return http.HttpResponseRedirect(app_settings['DOMAIN'] +
lang + '/' + entry_point + '.html')
else:
return view_func(request, *args, **kwargs)
View
@@ -3,8 +3,7 @@
from django.db import models
from django.http import Http404
-from mysmile.settings import LANGUAGES
-from mysmile.user_settings import user_settings
+from mysmile.settings.base import LANGUAGES, app_settings
from apps.pages.models import Page, Page_translation
@@ -31,7 +30,7 @@ def get_content(self, request, lang=None, slug=None):
c['slug'] = slug
c['current_year'] = datetime.now().strftime('%Y')
- c.update(user_settings)
+ c.update(app_settings)
c.update(content[0])
if c['youtube']:
@@ -45,7 +44,7 @@ def get_inner_nav(self, request, menu, slug):
if not temp in inner_nav: # work with sessions
inner_nav.append([slug, menu])
request.session['inner_nav'] = inner_nav # save data to the session
- while len(inner_nav) > user_settings['MAX_INNERLINK_HISTORY']:
+ while len(inner_nav) > app_settings['MAX_INNERLINK_HISTORY']:
inner_nav.pop(0)
return inner_nav
View
@@ -1,5 +1,5 @@
from django.db import models
-from mysmile.settings import LANGUAGES
+from mysmile.settings.base import LANGUAGES
class Page(models.Model):
View
@@ -1,6 +1,6 @@
from django.http import HttpResponse
-from mysmile.user_settings import user_settings
+from mysmile.settings.base import LANGUAGES, app_settings
from apps.pages.models import Page_translation
@@ -13,7 +13,7 @@ def SitemapXML(request):
<urlset xmlns = "http://www.sitemaps.org/schemas/sitemap/0.9">'
langs_and_slugs = Page_translation.objects.filter(page__status=1).values('lang', 'page__slug', 'updated_at').order_by('lang')
for item in langs_and_slugs:
- url = user_settings['DOMAIN_NAME'] + item['lang'] + '/' + item['page__slug'] + '.html'
+ url = app_settings['DOMAIN_NAME'] + item['lang'] + '/' + item['page__slug'] + '.html'
modified = item['updated_at'].strftime('%Y-%m-%d')
xml += createNode(url, modified)
xml += '</urlset>'
View
@@ -0,0 +1,30 @@
+# secret settings
+import os
+from mysmile.settings.base import BASE_DIR
+
+
+DEBUG = True
+
+SECRET_KEY = '=(j+x0_f%2t&$4gftv-^^w2mkr)+2ut8js0@0(gp6cx8z7kxlb'
+
+# Database
+# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(BASE_DIR, '../db/mysmile.sqlite3'),
+ #~ 'NAME': 'db/mysmile.sqlite3',
+ #~ 'USER': '',
+ #~ 'PASSWORD': '',
+ #~ 'HOST': '',
+ #~ 'PORT': '',
+ }
+}
+
+
+ALLOWED_HOSTS = ['127.0.0.1']
+
+ADMINS = (
+ ('admin', 'info@mysmile.com.ua'),
+)
View
No changes.
Binary file not shown.
@@ -69,8 +69,7 @@
<li class="toctree-l2"><a class="reference internal" href="Technical Specification/DatabaseSchema.html">1.9. Database Schema</a></li>
<li class="toctree-l2"><a class="reference internal" href="Technical Specification/AdminPanel.html">1.10. Admin panel</a></li>
<li class="toctree-l2"><a class="reference internal" href="Technical Specification/WhatIs.html">1.11. What is...</a></li>
-<li class="toctree-l2"><a class="reference internal" href="Technical Specification/NextReleases.html">1.12. Next Releases</a></li>
-<li class="toctree-l2"><a class="reference internal" href="Technical Specification/References.html">1.13. References</a></li>
+<li class="toctree-l2"><a class="reference internal" href="Technical Specification/References.html">1.12. References</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="REST API/index.html">2. REST API</a><ul>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 5dc52d7

Please sign in to comment.