Commit 298ec491 authored by Patrick Colmant's avatar Patrick Colmant

first commit

parents
[uwsgi]
vhost = true
plugins = python
socket = /tmp/apero.sock
master = true
enable-threads = true
processes = 2
buffer-size = 8192
env = DJANGO_SETTINGS_MODULE=mysite.apero_settings
wsgi-file = /home/pi/projects/mysite/mysite/wsgi.py
virtualenv = /home/pi/projects/
chdir = /home/pi/projects/mysite/
[uwsgi]
vhost = true
plugins = python
socket = /tmp/producteur.sock
master = true
enable-threads = true
processes = 2
buffer-size = 8192
env = DJANGO_SETTINGS_MODULE=mysite.producteur_settings
wsgi-file = /home/pi/projects/mysite/mysite/wsgi.py
virtualenv = /home/pi/projects/
chdir = /home/pi/projects/mysite/
[uwsgi]
vhost = true
plugins = python
socket = /tmp/ptidej.sock
master = true
enable-threads = true
processes = 2
buffer-size = 8192
env = DJANGO_SETTINGS_MODULE=mysite.ptidej_settings
wsgi-file = /home/pi/projects/mysite/mysite/wsgi.py
virtualenv = /home/pi/projects/
chdir = /home/pi/projects/mysite/
This diff is collapsed.
# -*- coding: utf-8 -*-
from common_settings import *
### Site 3 specific parameters
SITE_ID = 3
ALLOWED_HOSTS = ['apero.intergas.be',]
SECRET_KEY = '%+9cp2(c0&oe-7b##6uu1$y(s%8&7!eo=_-^ya6xxqvtof!jez'
# -*- coding: utf-8 -*-
# http://www.doodle.com/srxt9yh5yutqgkp85y6nxczk/admin
# http://www.doodle.com/srxt9yh5yutqgkp8
from settings import *
import os
gettext = lambda s: s
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
###################### Django
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'pi', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': 'pi',
'PASSWORD': 'raspberry',
'HOST': '127.0.0.1', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '5432', # Set to empty string for default.
}
}
TIME_ZONE = 'Europe/Brussels'
LANGUAGE_CODE = 'fr-BE'
STATIC_ROOT = os.path.join(PROJECT_PATH, "static")
STATIC_URL = "/static/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, "media")
MEDIA_URL = "/media/"
SOUTH_TESTS_MIGRATE = False
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
)
INSTALLED_APPS += (
# 'debug_toolbar',
'django.contrib.admin',
'south',
)
##################### Repanier
AUTHENTICATION_BACKENDS = ('repanier.auth_backend.RepanierCustomBackend',)
# ADMIN_LOGIN = 'pise'
# ADMIN_PASSWORD = 'raspberry'
INSTALLED_APPS += (
'repanier',
)
##################### Django CMS
LANGUAGES = [
('fr', 'French'),
('nl', 'Dutch'),
('en', 'English'),
]
TEMPLATE_DIRS = (
# The docs say it should be absolute path: PROJECT_PATH is precisely one.
# Life is wonderful!
os.path.join(PROJECT_PATH, "templates"),
)
CMS_TEMPLATES = (
('template_1.html', 'Template One'),
('template_2.html', 'Template Two'),
)
THUMBNAIL_DEBUG = False
MIDDLEWARE_CLASSES += (
'cms.middleware.multilingual.MultilingualURLMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS += (
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
)
INSTALLED_APPS += (
'djangocms_text_ckeditor',
'easy_thumbnails',
'cms',
'mptt',
'menus',
'sekizai',
'cms.plugins.file',
'cms.plugins.flash',
'cms.plugins.googlemap',
'cms.plugins.link',
'cms.plugins.picture',
'cms.plugins.snippet',
'cms.plugins.teaser',
# 'cms.plugins.text',
'cms.plugins.video',
'cms.plugins.twitter',
'django.contrib.sitemaps',
)
CMS_MENU_TITLE_OVERWRITE = False
CMS_SOFTROOT = True
CMS_PERMISSION = True
CMS_PUBLIC_FOR = 'all'
CMS_MODERATOR = True
CMS_SHOW_START_DATE = False
CMS_SHOW_END_DATE = False
CMS_SEO_FIELDS = True
CKEDITOR_SETTINGS = {
'language': '{{ language }}',
'toolbar': 'CMS',
'skin': 'moono'
}
\ No newline at end of file
# -*- coding: utf-8 -*-
from common_settings import *
### Site 1 specific parameters
SITE_ID = 1
ALLOWED_HOSTS = ['producteur.intergas.be',]
SECRET_KEY = '%+9cp2(c0&oe-6b##6uu1$y(s%8&7!eo=_-^ya6xxqvtof!jez'
# -*- coding: utf-8 -*-
from common_settings import *
### Site 2 specific parameters
SITE_ID = 2
ALLOWED_HOSTS = ['ptidej.intergas.be',]
SECRET_KEY = '%+9cp2(c0&oe-6b##6uu1$y(s%8&7!eo=_-^ya6xxqvtof!jez'
# Django settings for mysite project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.4/ref/settings/#allowed-hosts
ALLOWED_HOSTS = []
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'xh-%#cs3s0)3l!4*%vsdvnq(r!!&&)6(wx@cgdhe^hkquw8jo9'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'mysite.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'mysite.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
@charset "utf-8";
/*
* @copyright: https://github.com/divio/djangocms-text-ckeditor
*/
/* float left with the label */
.cke_chrome { float: left; }
/* special case when inside a text plugin */
.djangocms_text_ckeditor-text .form-row label { display:none; }
.djangocms_text_ckeditor-text .cke_chrome { float: none; }
/* insure dialog has relative positioning for absolute positioned content */
.cke_dialog_contents_body { position:relative; }
/* show cmsplugin label */
.cke_button__cmsplugins .cke_button_label { padding-left:5px; padding-right:5px; display:inline; }
\ No newline at end of file
// ensure namespace is defined
var CMS = window.CMS || {};
var jQuery = window.jQuery || django.jQuery;
/*##################################################|*/
/* #CMS.CKEDITOR# */
jQuery(document).ready(function ($) {
/*!
* CKEditor
* @version: 1.0.0
* @description: Adds cms specific plugins to CKEditor
*/
CMS.CKEditor = {
options: {
// ckeditor default settings, will be overwritten by CKEDITOR_SETTINGS
'language': 'en',
'skin': 'moono',
'toolbar': 'CMS',
'toolbar_CMS': [
['Undo', 'Redo'],
['cmsplugins', '-', 'ShowBlocks'],
['Format', 'Styles'],
['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
['Maximize', ''],
'/',
['Bold', 'Italic', 'Underline', '-', 'Subscript', 'Superscript', '-', 'RemoveFormat'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Link', 'Unlink'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Table'],
['Source']
],
'toolbarCanCollapse': false,
'extraPlugins': 'cmsplugins'
},
init: function (container, options, settings) {
this.container = $(container);
this.settings = settings;
this.options = $.extend(true, {}, this.options, options);
this.options.cmsPage = this.settings.page;
this.options.cmsPlugins = this.settings.plugins;
this.options.cmsLang = this.settings.lang;
// add additional plugins (autoloads plugins.js)
CKEDITOR.plugins.addExternal('cmsplugins', this.settings.static_url + 'ckeditor_plugins/cmsplugins/');
// render cckeditor
CKEDITOR.replace(container, this.options);
// add additional styling
CKEDITOR.on('instanceReady', $.proxy(CMS.CKEditor, 'setup'));
},
// setup is called after ckeditor has been initialized
setup: function () {
// add css tweks to the editor
this.styles();
},
styles: function () {
// add styling to source and fullscreen view
$('.cke_button__maximize, .cke_button__source').parent()
.css('margin-right', 0).parent()
.css('float', 'right');
}
};
});
\ No newline at end of file
{% load cms_tags sekizai_tags menu_tags %}
<html>
<head>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
{% language_chooser "menu/language_chooser.html" %}
{% placeholder base_content %}
{% block base_content %}{% endblock %}
{% render_block "js" %}
</body>
</html>
\ No newline at end of file
{% load thumbnail %}
{% if link %}<a href="{{ link }}">{% endif %}
{% if placeholder == "template_1_content" %}
<img src="{% thumbnail picture.image 400x300 %}"{% if picture.alt %} alt="{{ picture.alt }}"{% endif %} />
{% else %}
{% if placeholder == "teaser" %}
<img src="{% thumbnail picture.image 150x150 %}"{% if picture.alt %} alt="{{ picture.alt }}"{% endif %} />
{% endif %}
{% endif %}
{% if link %}</a>{% endif %}
\ No newline at end of file
{% extends "base.html" %}
{% load cms_tags %}
{% block base_content %}
{% placeholder template_1_content %}
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% load cms_tags %}
{% block base_content %}
{% placeholder template_2_content %}
{% endblock %}
\ No newline at end of file
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from cms.sitemaps import CMSSitemap
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': {'cmspages': CMSSitemap}}),
url(r'^', include('cms.urls')),
)
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
)
"""
WSGI config for mysite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.
Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)
from django.contrib import admin
from repanier.models import Producer
class ProducerAdmin(admin.ModelAdmin):
fields = ['login_site', 'site', 'short_name', 'full_name', 'description', 'phone', 'fax', 'google_map_URL', 'address', 'bank_account']
# exclude = ('site',)
admin.site.register(Producer, ProducerAdmin)
from repanier.models import Customer
admin.site.register(Customer)
from repanier.models import LUT_QuantityUnit
admin.site.register(LUT_QuantityUnit)
from repanier.models import LUT_CategoryForCustomer
admin.site.register(LUT_CategoryForCustomer)
from repanier.models import LUT_CategoryForProducer
admin.site.register(LUT_CategoryForProducer)
from repanier.models import LUT_CategoryForPreparator
admin.site.register(LUT_CategoryForPreparator)
from repanier.models import Product
admin.site.register(Product)
from repanier.models import LUT_PermanenceRole
admin.site.register(LUT_PermanenceRole)
from repanier.models import LUT_PermanenceLocation
admin.site.register(LUT_PermanenceLocation)
from repanier.models import Permanence
admin.site.register(Permanence)
from repanier.models import DutyRoster
admin.site.register(DutyRoster)
from repanier.models import Folder
admin.site.register(Folder)
from repanier.models import FolderItem
admin.site.register(FolderItem)
from repanier.models import Purchase
admin.site.register(Purchase)
from repanier.models import ProducerPayment
admin.site.register(ProducerPayment)
from repanier.models import CustomerPayment
admin.site.register(CustomerPayment)
\ No newline at end of file
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
class RepanierCustomBackend(ModelBackend):
def authenticate(self, **credentials):
user_or_none = super(RepanierCustomBackend, self).authenticate(**credentials)
if user_or_none:
if user_or_none.is_superuser:
if not (user_or_none.is_active):
user_or_none = None
else:
if user_or_none.userprofile.login_site_id != Site.objects.get_current().id:
user_or_none = None
return user_or_none
def get_user(self, user_id):
try:
user_or_none = User.objects.get(pk=user_id)
if user_or_none:
if user_or_none.is_superuser:
if not (user_or_none.is_active):
user_or_none = None
else:
if user_or_none.userprofile.login_site_id != Site.objects.get_current().id:
user_or_none = None
except User.DoesNotExist:
user_or_none = None
return user_or_none
\ No newline at end of file
from django.db import models
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(User)
# Nom, prenom, email, actif, equipe, surper-utilisateur, groupe, droits,
# date de derniere coonnnexion, date d'inscription.
login_site = models.ForeignKey(Site)
site = models.ManyToManyField(Site, related_name = 'userprofile__site')
objects = models.Manager()
on_site = CurrentSiteManager()
short_name = models.CharField(max_length=25)
full_name = models.CharField(max_length=100)
phone = models.CharField(max_length=100)
address = models.TextField()
# picture = models.ImageField()
class Producer(UserProfile):
description = models.TextField()
google_map_URL = models.URLField()
bank_account = models.CharField(max_length=100)
fax = models.CharField(max_length=100)
def __unicode__(self):
return self.short_name
class Customer(UserProfile):
def __unicode__(self):
return self.short_name
class LUT_QuantityUnit(models.Model):
site = models.ForeignKey(Site)
objects = models.Manager()
on_site = CurrentSiteManager()
short_name = models.CharField(max_length=25)
position = models.IntegerField(default=0)
description = models.CharField(max_length=200)
def __unicode__(self):
return self.short_name
class LUT_Category(models.Model):
site = models.ForeignKey(Site)
objects = models.Manager()
on_site = CurrentSiteManager()
short_name = models.CharField(max_length=25)
position = models.IntegerField(default=0)
description = models.CharField(max_length=200)
def __unicode__(self):
return self.short_name
class LUT_CategoryForCustomer(LUT_Category):
def __unicode__(self):
return self.short_name
class LUT_CategoryForProducer(LUT_Category):
def __unicode__(self):
return self.short_name
class LUT_CategoryForPreparator(LUT_Category):
def __unicode__(self):
return self.short_name
class Product(models.Model):
# Product portfolio
site = models.ManyToManyField(Site)
objects = models.Manager()
on_site = CurrentSiteManager()
producer = models.ForeignKey(Producer, on_delete=models.PROTECT)
short_name = models.CharField(max_length=25)
# picture = models.ImageField()
description = models.TextField()
more_info_URL = models.URLField()
category_for_customer = models.ForeignKey(LUT_CategoryForCustomer, on_delete=models.PROTECT)
position_into_category_for_customer = models.IntegerField(default=0)
# order into the categoryforcustomer
category_for_producer = models.ForeignKey(LUT_CategoryForProducer, on_delete=models.PROTECT)
position_into_category_for_producer = models.IntegerField(default=0)
# order into the categoryforproducer
category_forpreparator = models.ForeignKey(LUT_CategoryForPreparator, on_delete=models.PROTECT)
position_into_category_for_preparator = models.IntegerField(default=0)
# order into the categoryforpreparator
# for the customer :
customer_order_unit = models.ForeignKey(LUT_QuantityUnit, related_name = 'customer_order_unit+', on_delete=models.PROTECT)
# order unit (gr, bottle, Kg, pack of 500 grams, piece)
customer_minimum_order_quantity = models.IntegerField(default=0)
# minimum order qty (eg : 100 gr, 1 bottle, 3 Kg, 1 pack of 500 grams)
customer_increment_order_quantity = models.IntegerField(default=0)
# increment order qty (eg : 50 gr, 1 bottle, 3 Kg, 1 pack of 500 grams)
customer_maximum_order_quantity = models.IntegerField(default=0)
# maximum order qty (eg : 1500 gr, 10 bottles, 9 Kg, 10 pack of 500 grams)
# for the producer :
best_producer_give_order_detail_per_customer = models.BooleanField()
# need order detail per customer (yes/no)
producer_billing_unit = models.ForeignKey(LUT_QuantityUnit, related_name = 'producer_billing_unit+', on_delete=models.PROTECT)
# billing unit (if not the same as order unit)
producer_unit_price = models.DecimalField(max_digits=8, decimal_places=2)
# last known price (into the billing unit)
# for the buyer :
# must optimize the order (eg : 12 x 5 Kg => 2 x 25 Kg + 2 x 5 Kg)
# for the preparator :
best_preparator_record_the_quantity = models.BooleanField()
# must record the quantity (yes / no)
best_preparator_record_the_weight = models.BooleanField()
# must record the weight (yes / no)
best_preparator_record_t