init django server
authorrougeronj
Mon, 23 Feb 2015 12:40:17 +0100
changeset 12 1ada9d221ba3
parent 11 ffb8340ba86f
child 13 08f34bbc70ee
init django server
client/app/gallery/gallery.html
client/app/search/search.html
server/__init__.py
server/admin.py
server/manage.py
server/models.py
server/settings.py
server/urls.py
server/views.py
server/wsgi.py
--- a/client/app/gallery/gallery.html	Mon Oct 06 23:23:37 2014 +0200
+++ b/client/app/gallery/gallery.html	Mon Feb 23 12:40:17 2015 +0100
@@ -4,7 +4,7 @@
 <ul class="list-unstyled list-inline row gallery">
   <li class="col-md-3 item" ng-repeat="i in gallery.hits">
     <div class="img-ctn">
-        <img class="img img-responsive image" src="{{ i.metas_dict.images }}" />
+        <img class="img img-responsive image" ng-src="{{ i.metas_dict.images }}" />
         <p>{{ i.metas_dict.name }}</p>
         <div class="gallery-buttons">
           <a class="btn btn-default" href="#/slideshow/edit/{{ $index }}"><span class="glyphicon glyphicon-pencil"></span></a>
--- a/client/app/search/search.html	Mon Oct 06 23:23:37 2014 +0200
+++ b/client/app/search/search.html	Mon Feb 23 12:40:17 2015 +0100
@@ -3,7 +3,7 @@
 <div ng-if="results.nhits>0">
   <div class="row search-item" ng-repeat="h in results.hits" ng-init="h.imgbig=false">
       <div ng-class="{'col-md-5': h.imgbig, 'col-md-3': !h.imgbig}">
-        <img src="{{ h.metas_dict.images }}" ng-class="{'search-img-max': !h.imgbig}" ng-click="h.imgbig=!h.imgbig"/>
+        <img ng-src="{{ h.metas_dict.images }}" ng-class="{'search-img-max': !h.imgbig}" ng-click="h.imgbig=!h.imgbig"/>
       </div>
       <div ng-class="{'col-md-5': h.imgbig, 'col-md-7': !h.imgbig}">
 	      <p><strong>Nom&nbsp;:</strong> {{ h.metas_dict.name }}</p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/admin.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,7 @@
+from django.contrib import admin
+from models import Record
+
+
+admin.site.register(Record)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/manage.py	Mon Feb 23 12:40:17 2015 +0100
@@ -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)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/models.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,26 @@
+'''
+Created on Feb 19, 2014
+
+@author: jr
+'''
+
+from django.db import models
+from taggit.managers import TaggableManager
+
+
+class Record(models.Model):
+    
+    title = models.CharField(max_length=512, unique=False, blank=True, null=True)
+    description = models.CharField(max_length=512, unique=False, blank=True, null=True)
+    comment = models.CharField(max_length=512, unique=False, blank=True, null=True)
+    source = models.CharField(max_length=512, unique=False, blank=True, null=True)
+    url = models.URLField(max_length=2048, unique=True, blank=False, null=False)
+    url_image = models.URLField(max_length=2048, unique=True, blank=True, null=True)
+    favorite = models.BooleanField(default=False, db_index=True)
+    tags = TaggableManager()
+    
+    def __unicode__(self):
+        return unicode(self.title)
+    
+    class Meta:
+        app_label = 'record'
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/settings.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,84 @@
+"""
+Django settings for ammico project.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.7/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/1.7/ref/settings/
+"""
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+import os
+BASE_DIR = os.path.dirname(os.path.dirname(__file__))
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '0v@^(8qtky0yze1)_xrr15p9_lmd0xc@u^t--4_s7d6qlegd-l'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+TEMPLATE_DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = (
+    'django.contrib.admin',
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+)
+
+MIDDLEWARE_CLASSES = (
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.common.CommonMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+ROOT_URLCONF = 'urls'
+
+WSGI_APPLICATION = 'wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        
+        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+    }
+}
+
+# Internationalization
+# https://docs.djangoproject.com/en/1.7/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.7/howto/static-files/
+
+STATIC_URL = '/static/'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/urls.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,16 @@
+from django.conf.urls import patterns, include, url
+from django.contrib import admin
+from models import Record
+
+admin.autodiscover()
+
+admin.site.register(Record)
+
+urlpatterns = patterns('',
+    # Examples:
+    # url(r'^$', 'ammico.views.home', name='home'),
+    # url(r'^blog/', include('blog.urls')),
+
+    url(r'^admin/', include(admin.site.urls)),
+    url(r'^tour/', 'views.getTour', name='getTour'),
+)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/views.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,6 @@
+from django.http import HttpResponse
+import json
+
+def getTour(request):
+    #request tour from jamespot
+    return HttpResponse(content=json.dumps("{'test':true}"), content_type='application/json')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/wsgi.py	Mon Feb 23 12:40:17 2015 +0100
@@ -0,0 +1,14 @@
+"""
+WSGI config for ammico project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
+"""
+
+import os
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()