1. b7w
  2. LimitedFM

Commits

b7w  committed 490bbda

Optimize settings for django 1.4. Add wsgi file. Set python -B in fab file to prevent objects files.

  • Participants
  • Parent commits 06a5ceb
  • Branches django1.4

Comments (0)

Files changed (4)

File docs/intro/overview.rst

View file
 
 | For feedback look here :doc:`click </intro/feedback>`
 
-| Working application you can look `here <http://limited.isudo.ru/>`__
+| Working application you can look `here <http://limitedfm.isudo.ru/>`__
 
 | Limited file manager is open source project, released by BSD license.
 

File fabfile.py

View file
     if settings:
         SETTINGS = settings
     MANAGE_PATH = os.path.join( PROJECT_PATH, "manage.py" )
-    RUN = "python {manage} test {app} --settings=limited.{settings}; return 0"
+    RUN = "python -B {manage} test {app} --settings=limited.{settings}; return 0"
     clear( )
     if not os.path.exists( TMP_PATH ):
         os.mkdir( TMP_PATH )
     else:
         STATIC = STATIC_PATH
     print( "[ INFO ] Collect and gzip static " )
-    os.system( "python {manage} collectstatic --noinput".format( manage=MANAGE_PATH ) )
+    os.system( "python -B {manage} collectstatic --noinput".format( manage=MANAGE_PATH ) )
 
     files = list_files( STATIC, ("css", "js",) )
     for item in files:

File limited/settings.py.smpl

View file
 
 import os
 
-PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
+PROJECT_PATH = os.path.realpath( os.path.dirname( __file__ ) )
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
 ADMINS = (
-    # ('Your Name', 'your_email@example.com'),
+# ('Your Name', 'your_email@example.com'),
 )
 
 MANAGERS = ADMINS
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': 'FileManager',                      # 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.
+        'NAME': 'FileManager', # 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.
         'TEST_CHARSET': 'UTF8',
-    }
+        }
 }
 
 # Local time zone for this installation. Choices can be found here:
 # calendars according to the current locale
 USE_L10N = True
 
-# Absolute filesystem path to the directory that will hold user-uploaded files.
+# If you set this to False, Django will not use timezone-aware datetimes.
+USE_TZ = False
+
+# Absolute filesystem BasePath to the directory that will hold user-uploaded files.
 # Example: "/home/media/media.lawrence.com/media/"
-MEDIA_ROOT = os.path.join(PROJECT_PATH,'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 = '/media/'
+MEDIA_URL = ''
 
-# Absolute path to the directory static files should be collected to.
+# Absolute BasePath 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(PROJECT_PATH,"static")
+STATIC_ROOT = os.path.join( PROJECT_PATH, "static" )
 
 # URL prefix for static files.
 # Example: "http://media.lawrence.com/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.
+# 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
 STATICFILES_FINDERS = (
     'django.contrib.staticfiles.finders.FileSystemFinder',
     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
-)
+    #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
+    )
 
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = 'f0m4m_q#f@#sfo%_2&!ar)yce=bvprh-0)^b4dxjnpz)001!3b'
 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.Loader',
     'django.template.loaders.app_directories.Loader',
-#     'django.template.loaders.eggs.Loader',
-)
+    #     'django.template.loaders.eggs.Loader',
+    )
 
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
-)
+    )
 
-ROOT_URLCONF = 'urls'
+ROOT_URLCONF = 'limited.urls'
+
+# Python dotted path to the WSGI application used by Django's runserver.
+WSGI_APPLICATION = 'limited.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.
-    os.path.join(PROJECT_PATH,'templates'),
-)
+    os.path.join( PROJECT_PATH, 'templates' ),
+    )
 
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.admin',
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
-    'limited',
-    'lviewer',
-)
+    'limited.core',
+    'limited.lviewer',
+    )
 
 # A sample logging configuration. The only tangible logging
 # performed by this configuration is to send an email to
         'simple': {
             'format': '%(levelname)-6s %(asctime)s - %(name)s - %(funcName)s %(lineno)d, %(message)s',
             'datefmt': '%Y %b %d, %H:%M:%S',
+            },
         },
-    },
     'handlers': {
         'mail_admins': {
             'level': 'ERROR',
         'log-file': {
             'level': 'INFO',
             'class': 'logging.handlers.WatchedFileHandler',
-            'filename': 'app.log',
+            'filename': os.path.join( PROJECT_PATH, "tmp/app.log" ),
             'mode': 'a',
             'formatter': 'simple'
         },
-    },
+        },
     'loggers': {
         'django.request': {
-            'handlers': ['mail_admins','log-file'],
+            'handlers': ['mail_admins', 'log-file'],
             'level': 'ERROR',
             'propagate': True,
-        },
+            },
         'limited': {
-            'handlers':['log-file'],
+            'handlers': ['log-file'],
             'level': 'DEBUG',
             'propagate': True,
-        },
-    }
+            },
+        }
 }
 
 LOGIN_URL = "/login/"

File limited/wsgi.py

View file
+"""
+WSGI config for BelieveViewer 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", "limited.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)