Beispiel #1
0
def get_res_dir_path(dir_name=''):
    return os.path.join(get_ionyweb_path(), RES_DIR, dir_name)
Beispiel #2
0
# -*- coding: utf-8 -*-
# Django settings for the ionyweb project.
from ionyweb import get_ionyweb_path

import os

SITE_ID = 1
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

AUTH_PROFILE_MODULE = 'authentication.UserProfile'

USE_I18N = True
USE_L10N = True

LOCALE_PATHS = (
    os.path.join(get_ionyweb_path(), 'locale'),
)

STATIC_URL = '/_static/'
MEDIA_URL = '/_medias/'

GRAPPELLI_ADMIN_URL = '/_admin/'
ADMIN_MEDIA_PREFIX = '/_static/grappelli/'

INTERNAL_IPS = ('127.0.0.1', )

# Additional locations of static files
STATICFILES_DIRS = (
    os.path.join(get_ionyweb_path(), 'static'),
)
Beispiel #3
0
# -*- coding: utf-8 -*-
# Django settings for the ionyweb project.
from ionyweb import get_ionyweb_path

import os

SITE_ID = 1
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

AUTH_PROFILE_MODULE = 'authentication.UserProfile'

USE_I18N = True
USE_L10N = True

LOCALE_PATHS = (os.path.join(get_ionyweb_path(), 'locale'), )

STATIC_URL = '/_static/'
MEDIA_URL = '/_medias/'

GRAPPELLI_ADMIN_URL = '/_admin/'
ADMIN_MEDIA_PREFIX = '/_static/grappelli/'

INTERNAL_IPS = ('127.0.0.1', )

# Additional locations of static files
STATICFILES_DIRS = (os.path.join(get_ionyweb_path(), 'static'), )

STATICFILES_FINDERS = (
    'ionyweb.loaders.layouts_finders.StaticFinder',
    'ionyweb.loaders.themes_finders.StaticFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
Beispiel #4
0
def start_app(args):
    args.app_name.replace('page_', '')

    print "Starting creation of : %s\n" % args.app_name

    # Path of resource files dir for creating app
    app_res_dir = get_res_dir_path('app_templates')
    # Path of Apps dir
    if os.path.exists(args.app_dir):
        apps_dir = args.app_dir
    else:
        apps_dir = os.path.join(get_ionyweb_path(), APPS_DIR)
    # Complete path of app
    app_path = os.path.join(apps_dir, 'page_%s' % args.app_name)
    # App Object Name
    app_object_name = ''.join([item.capitalize() for item in args.app_name.split('_')])

    env = Environment(loader=PackageLoader('ionyweb.bin', 'templates/app_templates'))

    # Create app_app/app_name_dir
    if os.path.exists(app_path):
        print >> sys.stderr, 'Error : %s already exists' % app_path
        return 2
    os.mkdir(app_path)
    open(os.path.join(app_path, '__init__.py'), 'w').close() 
    print 'App dir created.'

    # Create models.py
    render_to_file(env, 'models.py', app_path, context={'app_object_name': app_object_name})
    print 'App Models file created.'

    # Create views.py
    render_to_file(env, 'views.py', app_path, context={'app_name': args.app_name})
    print 'App Views created.'

    # Create forms.py
    render_to_file(env, 'forms.py', app_path, context={'app_object_name': app_object_name})
    print 'App Forms created.'

    # Create urls.py
    render_to_file(env, 'urls.py', app_path, context={'app_object_name': app_object_name})
    print 'App Urls created.'

    # Create admin.py
    render_to_file(env, 'admin.py', app_path, context={'app_object_name': app_object_name})
    print 'App Admin created.'

    # Create Templates Dir and index.html
    app_templates_dir = os.path.join(app_path, 'templates', 'page_%s' % args.app_name)
    os.makedirs(app_templates_dir)
    render_to_file(env, 'index.html', app_templates_dir, context={'app_object_name': app_object_name})
    print 'App Templates created.'

    # Create locale dir for translations
    locale_dir = os.path.join(app_path, 'locale')
    os.mkdir(locale_dir)
    print 'App Locale dir created.'

    print '\n\nNow just define your models,'
    print 'Custom the default template : \'index.html\','
    print 'Add your app to your INSTALLED_APPS : \'page_%s\'' % args.app_name
    print 'Synchronise the database.'
    print ' => Your app is fully configured !\n'
Beispiel #5
0
# 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 = os.path.join(ABSOLUTE_PATH, 'collected_static/')
STATIC_URL = '/_static/'
ADMIN_MEDIA_PREFIX = '/_static/admin/'

# 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.
    # os.path.join(ABSOLUTE_PATH, 'static'),
    os.path.join(get_ionyweb_path(), 'static'),
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '1m9nzx0y41_p3s8k%^iu-91-&c=*(9*yr)g20n+so1&#a%ee#x'

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.
    # os.path.join(ABSOLUTE_PATH, 'templates'),
    os.path.join(get_ionyweb_path(), 'templates'),
)

LAYOUTS_DIRS = (
    # os.path.join(ABSOLUTE_PATH, 'layouts'),
Beispiel #6
0
 def __init__(self, location=None, *args, **kwargs):
     if location is None:
         sys.stderr.write('\n\n'+str(location)+'\n\n')
         location = os.path.join(get_ionyweb_path(), 'contrib', 'themes')
     
     super(ThemeStorage, self).__init__(location, *args, **kwargs)
Beispiel #7
0
def get_res_dir_path(dir_name=''):
    return os.path.join(get_ionyweb_path(), RES_DIR, dir_name)
Beispiel #8
0
def start_app(args):
    args.app_name.replace('page_', '')

    print "Starting creation of : %s\n" % args.app_name

    # Path of resource files dir for creating app
    app_res_dir = get_res_dir_path('app_templates')
    # Path of Apps dir
    if os.path.exists(args.app_dir):
        apps_dir = args.app_dir
    else:
        apps_dir = os.path.join(get_ionyweb_path(), APPS_DIR)
    # Complete path of app
    app_path = os.path.join(apps_dir, 'page_%s' % args.app_name)
    # App Object Name
    app_object_name = ''.join(
        [item.capitalize() for item in args.app_name.split('_')])

    env = Environment(
        loader=PackageLoader('ionyweb.bin', 'templates/app_templates'))

    # Create app_app/app_name_dir
    if os.path.exists(app_path):
        print >> sys.stderr, 'Error : %s already exists' % app_path
        return 2
    os.mkdir(app_path)
    open(os.path.join(app_path, '__init__.py'), 'w').close()
    print 'App dir created.'

    # Create models.py
    render_to_file(env,
                   'models.py',
                   app_path,
                   context={'app_object_name': app_object_name})
    print 'App Models file created.'

    # Create views.py
    render_to_file(env,
                   'views.py',
                   app_path,
                   context={'app_name': args.app_name})
    print 'App Views created.'

    # Create forms.py
    render_to_file(env,
                   'forms.py',
                   app_path,
                   context={'app_object_name': app_object_name})
    print 'App Forms created.'

    # Create urls.py
    render_to_file(env,
                   'urls.py',
                   app_path,
                   context={'app_object_name': app_object_name})
    print 'App Urls created.'

    # Create admin.py
    render_to_file(env,
                   'admin.py',
                   app_path,
                   context={'app_object_name': app_object_name})
    print 'App Admin created.'

    # Create Templates Dir and index.html
    app_templates_dir = os.path.join(app_path, 'templates',
                                     'page_%s' % args.app_name)
    os.makedirs(app_templates_dir)
    render_to_file(env,
                   'index.html',
                   app_templates_dir,
                   context={'app_object_name': app_object_name})
    print 'App Templates created.'

    # Create locale dir for translations
    locale_dir = os.path.join(app_path, 'locale')
    os.mkdir(locale_dir)
    print 'App Locale dir created.'

    print '\n\nNow just define your models,'
    print 'Custom the default template : \'index.html\','
    print 'Add your app to your INSTALLED_APPS : \'page_%s\'' % args.app_name
    print 'Synchronise the database.'
    print ' => Your app is fully configured !\n'
Beispiel #9
0
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '%s/_medias/' % SITE_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 = os.path.join(ABSOLUTE_PATH, 'collected_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.
    # os.path.join(ABSOLUTE_PATH, 'static'),
    os.path.join(get_ionyweb_path(), 'static'), )

# Make this unique, and don't share it with anybody.
SECRET_KEY = '%%euveygk*qrx3d$h15nn_t85yb-1v5n7&0%f2n8ge4h2q^8$%'

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.
    # os.path.join(ABSOLUTE_PATH, 'templates'),
    os.path.join(get_ionyweb_path(), 'templates'), )

LAYOUTS_DIRS = (
    # os.path.join(ABSOLUTE_PATH, 'layouts'),
    os.path.join(get_ionyweb_path(), 'contrib', 'layouts'), )