From f8f57680904c956204093e6b027284a50c2d1dd6 Mon Sep 17 00:00:00 2001 From: Artur Barseghyan Date: Fri, 6 Dec 2013 19:15:13 +0100 Subject: [PATCH] example project --- .gitignore | 23 +- .hgignore | 22 ++ example/README.rst | 73 +++++ example/example/__init__.py | 0 example/example/foo/__init__.py | 0 example/example/foo/admin.py | 59 +++++ example/example/foo/models.py | 45 ++++ example/example/local_settings.example | 25 ++ example/example/manage.py | 10 + example/example/settings.py | 352 +++++++++++++++++++++++++ example/example/test.sh | 4 + example/example/urls.py | 22 ++ example/example/wsgi.py | 32 +++ example/requirements.txt | 10 + example/setup.sh | 1 + install.sh | 6 + reinstall.sh | 3 + uninstall.sh | 6 + 18 files changed, 691 insertions(+), 2 deletions(-) create mode 100644 .hgignore create mode 100644 example/README.rst create mode 100644 example/example/__init__.py create mode 100644 example/example/foo/__init__.py create mode 100644 example/example/foo/admin.py create mode 100644 example/example/foo/models.py create mode 100644 example/example/local_settings.example create mode 100755 example/example/manage.py create mode 100644 example/example/settings.py create mode 100755 example/example/test.sh create mode 100644 example/example/urls.py create mode 100644 example/example/wsgi.py create mode 100644 example/requirements.txt create mode 100755 example/setup.sh create mode 100755 install.sh create mode 100755 reinstall.sh create mode 100755 uninstall.sh diff --git a/.gitignore b/.gitignore index 9bedf31..92931da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,22 @@ -*.pyc +*.py[cod] +.hgignore~ +.gitignore~ +.hg/ +.hgtags +.tox/ +.travis.yml~ + +MANIFEST.in~ +tmp/ +.zip +example/db/ +example/tmp/ +example/logs/ +example/media/ +example/static/ +builddocs/ +builddocs.zip +build/ dist/ -django_media_manager.egg-info/ \ No newline at end of file +django_media_manager.egg-info +example/example/local_settings.py \ No newline at end of file diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..6a41d91 --- /dev/null +++ b/.hgignore @@ -0,0 +1,22 @@ +syntax: regexp +\.pyc$ +\.hgignore~ +\.gitignore~ +\.git/ +\.tox/ +\.travis\.yml~ + +^MANIFEST\.in~ +^tmp/ +\.zip +^example/media/ +^example/db/ +^example/tmp/ +^example/logs/ +^example/static/ +^example/example/local_settings.py +^builddocs/ +^builddocs.zip +^build/ +^dist/ +^django_media_manager\.egg-info diff --git a/example/README.rst b/example/README.rst new file mode 100644 index 0000000..662ed97 --- /dev/null +++ b/example/README.rst @@ -0,0 +1,73 @@ +============================================ +Example project for `django-dash` +============================================ +Follow instructions below to install the example project. Commands below are written for Ubuntu/Debian, +but may work on other Linux distributions as well. + +- Create a new- or switch to existing- virtual environement. + + $ virtualenv dash + + $ source dash/bin/activate + +- Download the latest stable version of django-dash. + + $ wget https://github.com/barseghyanartur/django-dash/archive/stable.tar.gz + +- Unpack it somewhere. + + $ tar -xvf stable.tar.gz + +- Go to the unpacked directory. + + $ cd django-dash-stable + +- Install Django, requirements and finally django-dash. + + $ pip install Django + + $ pip install -r example/requirements.txt + + $ pip install -e git+https://github.com/barseghyanartur/django-dash@stable#egg=django-dash + +- Create some directories. + + $ mkdir example/media/ + + $ mkdir example/media/static/ + + $ mkdir example/static/ + + $ mkdir example/db/ + +- Copy local_settings.example + + $ cp example/example/local_settings.example example/example/local_settings.py + +- Run the commands to sync database, install test data and run the server. + + $ python example/example/manage.py syncdb --noinput --traceback -v 3 + + $ python example/example/manage.py migrate --noinput + + $ python example/example/manage.py collectstatic --noinput --traceback -v 3 + + $ python example/example/manage.py news_create_test_data --traceback -v 3 + + $ python example/example/manage.py dash_create_test_data --traceback -v 3 + + $ python example/example/manage.py runserver 0.0.0.0:8001 --traceback -v 3 + +- Open your browser and test the app. + +Dashboard: + +- URL: http://127.0.0.1:8001/dashboard/ +- Admin username: test_admin +- Admin password: test + +Django admin interface: + +- URL: http://127.0.0.1:8001/administration/ +- Admin username: test_admin +- Admin password: test \ No newline at end of file diff --git a/example/example/__init__.py b/example/example/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/example/foo/__init__.py b/example/example/foo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/example/example/foo/admin.py b/example/example/foo/admin.py new file mode 100644 index 0000000..c8dca79 --- /dev/null +++ b/example/example/foo/admin.py @@ -0,0 +1,59 @@ +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ + +from foo.models import FooItem, Foo2Item, Foo3Item, Foo4Item + + +class FooItemBaseAdmin(admin.ModelAdmin): + """ + Foo item admin. + """ + list_display = ('title', 'date_published') + prepopulated_fields = {'slug': ('title',)} + list_filter = ('date_published',) + readonly_fields = ('date_created', 'date_updated',) + + fieldsets = ( + (None, { + 'fields': ('title', 'slug', 'body',) + }), + (_("Publication date"), { + 'classes': ('',), + 'fields': ('date_published',) + }), + (_("Additional"), { + 'classes': ('collapse',), + 'fields': ('date_created', 'date_updated') #, + }) + ) + + class Meta: + app_label = _('Foo item') + + +class FooItemAdmin(FooItemBaseAdmin): + class Meta: + app_label = _('Foo item') + +admin.site.register(FooItem, FooItemAdmin) + + +class Foo2ItemAdmin(FooItemBaseAdmin): + class Meta: + app_label = _('Foo 2 item') + +admin.site.register(Foo2Item, Foo2ItemAdmin) + + +class Foo3ItemAdmin(FooItemBaseAdmin): + class Meta: + app_label = _('Foo 3 item') + +admin.site.register(Foo3Item, Foo3ItemAdmin) + + +class Foo4ItemAdmin(FooItemBaseAdmin): + class Meta: + app_label = _('Foo 4 item') + +admin.site.register(Foo4Item, Foo4ItemAdmin) \ No newline at end of file diff --git a/example/example/foo/models.py b/example/example/foo/models.py new file mode 100644 index 0000000..1bceab7 --- /dev/null +++ b/example/example/foo/models.py @@ -0,0 +1,45 @@ +import datetime + +from django.db import models +from django.utils.translation import ugettext_lazy as _ + +from tinymce.models import HTMLField + +class FooItemBase(models.Model): + """ + Foo item base. + """ + title = models.CharField(_("Title"), max_length=100) + slug = models.SlugField(_("Slug"), unique=True) + body = HTMLField(_("Body")) + date_published = models.DateTimeField(_("Date published"), blank=True, null=True, default=datetime.datetime.now()) + date_created = models.DateTimeField(_("Date created"), blank=True, null=True, auto_now_add=True, editable=False) + date_updated = models.DateTimeField(_("Date updated"), blank=True, null=True, auto_now=True, editable=False) + + class Meta: + abstract = True + verbose_name = _("Foo item") + verbose_name_plural = _("Foo items") + + def __unicode__(self): + return self.title + +class FooItem(FooItemBase): + class Meta: + verbose_name = _("Foo item") + verbose_name_plural = _("Foo items") + +class Foo2Item(FooItemBase): + class Meta: + verbose_name = _("Foo 2 item") + verbose_name_plural = _("Foo 2 items") + +class Foo3Item(FooItemBase): + class Meta: + verbose_name = _("Foo 3 item") + verbose_name_plural = _("Foo 3 items") + +class Foo4Item(FooItemBase): + class Meta: + verbose_name = _("Foo 4 item") + verbose_name_plural = _("Foo 4 items") \ No newline at end of file diff --git a/example/example/local_settings.example b/example/example/local_settings.example new file mode 100644 index 0000000..4ed4270 --- /dev/null +++ b/example/example/local_settings.example @@ -0,0 +1,25 @@ +import os +PROJECT_DIR = lambda base : os.path.abspath(os.path.join(os.path.dirname(__file__), base).replace('\\','/')) + +DEBUG = True +DEBUG_TOOLBAR = not True +TEMPLATE_DEBUG = DEBUG + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': PROJECT_DIR('../db/example.db'), # Or path to database file if using sqlite3. + # The following settings are not used with sqlite3: + 'USER': '', + 'PASSWORD': '', + 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. + 'PORT': '', # Set to empty string for default. + } +} + +INTERNAL_IPS = ('127.0.0.1',) + +EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' +EMAIL_FILE_PATH = PROJECT_DIR('../tmp') + +DEFAULT_FROM_EMAIL = '' diff --git a/example/example/manage.py b/example/example/manage.py new file mode 100755 index 0000000..f9726f9 --- /dev/null +++ b/example/example/manage.py @@ -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) diff --git a/example/example/settings.py b/example/example/settings.py new file mode 100644 index 0000000..d0189d0 --- /dev/null +++ b/example/example/settings.py @@ -0,0 +1,352 @@ +# Django settings for example project. +import os +PROJECT_DIR = lambda base : os.path.abspath(os.path.join(os.path.dirname(__file__), base).replace('\\','/')) +gettext = lambda s: s + +DEBUG = False +DEBUG_TOOLBAR = False +TEMPLATE_DEBUG = DEBUG + +ADMINS = ( + # ('Your Name', 'your_email@example.com'), +) + +MANAGERS = ADMINS + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': PROJECT_DIR('../db/example.db'), # Or path to database file if using sqlite3. + # The following settings are not used with sqlite3: + 'USER': '', + 'PASSWORD': '', + 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. + 'PORT': '', # Set to empty string for default. + } +} + +# Hosts/domain names that are valid for this site; required if DEBUG is False +# See https://docs.djangoproject.com/en/1.5/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' + +LANGUAGES = ( + ('en', gettext("English")), # Main language! + ('hy', gettext("Armenian")), + ('nl', gettext("Dutch")), + ('ru', gettext("Russian")), +) + +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: "/var/www/example.com/media/" +MEDIA_ROOT = PROJECT_DIR(os.path.join('..', 'media')) + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash. +# Examples: "http://example.com/media/", "http://media.example.com/" +MEDIA_URL = '/media/' + +# 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: "/var/www/example.com/static/" +STATIC_ROOT = PROJECT_DIR(os.path.join('..', 'static')) + +# URL prefix for static files. +# Example: "http://example.com/static/", "http://static.example.com/" +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. + PROJECT_DIR(os.path.join('..', 'media', 'static')), +) + +# 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 = '6sf18c*w971i8a-m^1coasrmur2k6+q5_kyn*)s@(*_dk5q3&r' + +# 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.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + '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 = 'urls' + +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = 'wsgi.application' + +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.core.context_processors.tz", + "django.contrib.messages.context_processors.messages", + "django.core.context_processors.request" +) + +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. + PROJECT_DIR('templates') +) + +#FIXTURE_DIRS = ( +# PROJECT_DIR(os.path.join('..', 'fixtures')) +#) + +INSTALLED_APPS = ( + # Django core and contrib apps + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'django.contrib.admin', + 'django.contrib.sitemaps', + + # Third party apps used in the project + 'south', # Database migration app + 'tinymce', # TinyMCE + 'filebrowser', # Filebrowser for TinyMCE + + # Other project specific apps + #'admin_tools_dashboard', # Admin dashboard + 'foo', # Test app +) + +LOGIN_REDIRECT_URL = '/' +LOGIN_URL = '/accounts/login/' +LOGIN_ERROR_URL = '/accounts/login/' +LOGOUT_URL = '/accounts/logout/' + +# localeurl locale independent paths (language code won't be appended) +LOCALE_INDEPENDENT_PATHS = ( + r'^/sitemap.*\.xml$', # Global regex for all XML sitemaps + #r'^/administration/', + #r'^/dashboard/', +) + +# Tell localeurl to use sessions for language store. +LOCALEURL_USE_SESSION = True + +# TinyMCE Settings +TINYMCE_JS_URL = os.path.join(STATIC_URL, 'tiny_mce/tiny_mce.js') +TINYMCE_JS_ROOT = os.path.join(STATIC_URL, 'tiny_mce/') +TINYMCE_CONFIG_PLUGINS = "inlinepopups,visualchars,paste,media,template,table" +TINYMCE_CONFIG_THEME = "advanced" +TINMYCE_CONFIG_MODE = "textareas" +TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS1 = "formatselect,styleselect,|,bold,italic,underline,|,undo,redo,|,bullist,numlist,hr,|,link,unlink,anchor,|,charmap,|,image,media,|,code,|,pastetext,pasteword,tablecontrols" +TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS2 = "" +TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS3 = "" +TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS4 = "" +TINYMCE_CONFIG_THEME_ADVANCED_TOOLBAR_LOCATION = "top" +TINYMCE_CONFIG_THEME_ADVANCED_TOOLBAR_ALIGN = "left" +TINYMCE_CONFIG_THEME_ADVANCED_STATUSBAR_LOCATION = "bottom" +TINYMCE_CONFIG_THEME_ADVANCED_PATH = 0 +TINYMCE_CONFIG_THEME_ADVANCED_RESIZING = 1 +TINYMCE_CONFIG_RELATIVE_URLS = 0 +TINYMCE_CONFIG_WIDTH = '90%' +TINYMCE_CONFIG_HEIGHT = '300' +TINYMCE_CONFIG_DELTA_HEIGHT = '300' +TINYMCE_CONFIG_THEME_ADVANCED_RESIZE_HORIZONTAL = 0 +TINYMCE_CONFIG_CONTENT_CSS = MEDIA_URL +"css/style_tinymce.css" +TINYMCE_CONFIG_THEME_ADVANCED_BLOCKFORMATS = "p,h2,h3,h4,h5,blockquote" #h1, +TINYMCE_CONFIG_THEME_ADVANCED_STYLES = "Big=big;Uppercase=uppercase;h1=h1;h2=h2;h3=h3;h4=h4;h5=h5;h6=h6" +TINYMCE_DEFAULT_CONFIG = { + 'plugins': TINYMCE_CONFIG_PLUGINS, + 'theme': TINYMCE_CONFIG_THEME, + 'mode': TINMYCE_CONFIG_MODE, + 'theme_advanced_buttons1': TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS1, + 'theme_advanced_buttons2': TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS2, + 'theme_advanced_buttons3': TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS3, + 'theme_advanced_buttons4': TINYMCE_CONFIG_THEME_ADVANCED_BUTTONS4, + 'theme_advanced_toolbar_location': TINYMCE_CONFIG_THEME_ADVANCED_TOOLBAR_LOCATION, + 'theme_advanced_toolbar_align': TINYMCE_CONFIG_THEME_ADVANCED_TOOLBAR_ALIGN, + 'theme_advanced_statusbar_location': TINYMCE_CONFIG_THEME_ADVANCED_STATUSBAR_LOCATION, + 'theme_advanced_path': TINYMCE_CONFIG_THEME_ADVANCED_PATH, + 'theme_advanced_resizing': TINYMCE_CONFIG_THEME_ADVANCED_RESIZING, + 'relative_urls': TINYMCE_CONFIG_RELATIVE_URLS, + 'width': TINYMCE_CONFIG_WIDTH, + 'delta_height': TINYMCE_CONFIG_DELTA_HEIGHT, + 'theme_advanced_resize_horizontal': TINYMCE_CONFIG_THEME_ADVANCED_RESIZE_HORIZONTAL, + #'content_css' : TINYMCE_CONFIG_CONTENT_CSS, + 'theme_advanced_blockformats': TINYMCE_CONFIG_THEME_ADVANCED_BLOCKFORMATS, + 'external_link_list_url': "ss.mp4", + #"file_browser_callback": TINYMCE_CONFIG_FILEBROWSER_CALLBACK, + # Style formats + 'theme_advanced_styles': TINYMCE_CONFIG_THEME_ADVANCED_STYLES, + 'paste_auto_cleanup_on_paste': 1, + 'cleanup_on_startup': 1, + 'custom_undo_redo_levels': 20, + 'paste_remove_styles': 1, + 'paste_remove_styles_if_webkit': 1, + 'paste_strip_class_attributes': 1, +} + +# HTML tags which come from TinyMCE will be whitelisted to this list. +TINYMCE_DISABLE_CLEANING = True +TINYMCE_ALLOWED_TAGS = [ + 'a', 'b', 'em', 'i', 'h1', 'h2', 'h3', 'h4', 'h5', \ + 'li', 'ol', 'p', 'strong', 'ul', 'img', 'br', 'table', \ + 'thead', 'tbody', 'th', 'tr', 'td', 'blockquote', 'hr' +] +TINYMCE_ALLOWED_ATTRIBUTES = { + 'a': ['href', 'title', 'style', 'align', 'class'], + 'img': ['id', 'src', 'alt', 'style', 'width', 'height', 'class', 'title', 'align'], + 'div': ['class', 'style'], + 'table': ['cellpadding', 'cellspacing', 'border',], + 'object': ['class', 'style', 'width', 'height', 'data', 'type', 'id', 'align'], + 'param': ['name', 'value'], +} +TINYMCE_ALLOWED_STYLES = ['width', 'height'] + +FEINCMS_RICHTEXT_INIT_CONTEXT = { + 'TINYMCE_JS_URL': TINYMCE_JS_URL, + 'TINYMCE_CONTENT_CSS_URL': MEDIA_URL +"css/style_tinymce.css", + 'TINYMCE_LINK_LIST_URL': None +} + +#URL_FILEBROWSER_MEDIA = '%sfilebrowser/' % (STATIC_URL) +#FILEBROWSER_URL_FILEBROWSER_MEDIA = '%sfilebrowser/' % (STATIC_URL) +#FILEBROWSER_URL_WWW = '%suploads/' % (MEDIA_URL) +#FILEBROWSER_URL_TINYMCE = TINYMCE_JS_ROOT +FILEBROWSER_DIRECTORY = 'uploads/' +# A list of Images to generate in the format (prefix, image width). +FILEBROWSER_IMAGE_GENERATOR_LANDSCAPE = [('500px_width_', 500), ('230px_width_', 230),] + +# A list of Images to generate in the format (prefix, image width). +FILEBROWSER_IMAGE_GENERATOR_PORTRAIT = [('500px_width_', 500), ('230px_width_', 230),] + +# A list of Images to generate in the format (prefix, image width, image height). +FILEBROWSER_IMAGE_CROP_GENERATOR = [] + +#FILEBROWSER_EXTENSIONS = { +# 'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'], +# 'Document': ['.pdf','.doc','.rtf','.txt','.xls','.csv'], +# 'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'], +# 'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p'] +#} +#FILEBROWSER_SELECT_FORMATS = { +# 'File': ['Folder','Image','Document','Video','Audio'], +# 'Image': ['Image'], +# 'Document': ['Document'], +# 'Media': ['Video','Audio'], +#} + +# 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' + } + }, + 'formatters': { + 'verbose': { + 'format': '%(levelname)s %(asctime)s [%(pathname)s:%(lineno)s] %(message)s' + }, + 'simple': { + 'format': '%(levelname)s %(message)s' + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'verbose' + }, + 'django_log': { + 'level':'DEBUG', + 'class':'logging.handlers.RotatingFileHandler', + 'filename': PROJECT_DIR("../logs/django.log"), + 'maxBytes': 1048576, + 'backupCount': 99, + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'django': { + 'handlers': ['django_log'], + 'level': 'ERROR', + 'propagate': True, + }, + }, +} + +# Do not put any settings below this line +try: + from local_settings import * +except: + pass + +if DEBUG and DEBUG_TOOLBAR: + # debug_toolbar + MIDDLEWARE_CLASSES += ( + 'debug_toolbar.middleware.DebugToolbarMiddleware', + ) + + INSTALLED_APPS += ( + 'debug_toolbar', + ) + + DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': False, + } diff --git a/example/example/test.sh b/example/example/test.sh new file mode 100755 index 0000000..b0aa913 --- /dev/null +++ b/example/example/test.sh @@ -0,0 +1,4 @@ +cd ../../ +./install.sh +reset +python example/example/manage.py dash_test --traceback \ No newline at end of file diff --git a/example/example/urls.py b/example/example/urls.py new file mode 100644 index 0000000..f7d4927 --- /dev/null +++ b/example/example/urls.py @@ -0,0 +1,22 @@ +from django.conf.urls import patterns, include, url + +from django.conf import settings +from django.contrib import admin +from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.conf.urls.static import static + +admin.autodiscover() + +urlpatterns = patterns('', + (r'^admin/filebrowser/', include('filebrowser.urls')), + # Uncomment the next line to enable the admin: + + # tinymce + url(r'^tinymce/', include('tinymce.urls')), + + url(r'^admin/', include(admin.site.urls)), +) + +if settings.DEBUG: + urlpatterns += staticfiles_urlpatterns() + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/example/example/wsgi.py b/example/example/wsgi.py new file mode 100644 index 0000000..9f3e21b --- /dev/null +++ b/example/example/wsgi.py @@ -0,0 +1,32 @@ +""" +WSGI config for example 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 + +# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks +# if running multiple sites in the same mod_wsgi process. To fix this, use +# mod_wsgi daemon mode with each site in its own daemon process, or use +# os.environ["DJANGO_SETTINGS_MODULE"] = "example.settings" +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.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) diff --git a/example/requirements.txt b/example/requirements.txt new file mode 100644 index 0000000..f0a02d0 --- /dev/null +++ b/example/requirements.txt @@ -0,0 +1,10 @@ +Django==1.5.4 +PIL==1.1.7 +South==0.8.2 +django-debug-toolbar==0.11.0 +django-media-manager==3.3.1 +django-tinymce==1.5.2 +ipdb==0.8 +ordereddict==1.1 +selenium==2.35.0 +tox==1.6.1 diff --git a/example/setup.sh b/example/setup.sh new file mode 100755 index 0000000..e86ddcb --- /dev/null +++ b/example/setup.sh @@ -0,0 +1 @@ +mkdir -p media/static/ media/uploads/ static/ db/ logs/ \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..855c464 --- /dev/null +++ b/install.sh @@ -0,0 +1,6 @@ +pip install -r example/requirements.txt +python setup.py install +mkdir -p example/media/static/ example/media/uploads/ example/static/ example/db/ example/logs/ +python example/example/manage.py collectstatic --noinput +python example/example/manage.py syncdb --noinput +python example/example/manage.py migrate --noinput \ No newline at end of file diff --git a/reinstall.sh b/reinstall.sh new file mode 100755 index 0000000..bc765b3 --- /dev/null +++ b/reinstall.sh @@ -0,0 +1,3 @@ +reset +./uninstall.sh +./install.sh \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..0f60aae --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,6 @@ +pip uninstall django-media-manager -y +rm build -rf +rm dist -rf +rm src/django_media_manager.egg-info -rf +rm builddocs.zip +rm builddocs/ -rf \ No newline at end of file