Main Documentation for django-sciweb¶
django-sciweb will manage and create websites on the fly for general e-commerce and affiliate marketing purposes
Contents:
Requirements¶
Please install the following packages using PIP or easy_install
- Django 1.4.1
- South >= 0.7.6
- Django-lettuce >= 0.1.27
- nosetools
- Simplejson
Local Settings¶
Local settings should be created to:
- Set your database configuration
- Allow support for multi-dev environments
- Separate configuration for development/staging/production servers
- Set admin-on / admin-off settings to open the admin pages
Local Settings Template¶
The git repository is provided with a template called local_settings.template
Local Settings Code¶
You can copy paste this code into your local_settings.py if you are lazy:
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
ENABLE_ADMIN = True
DEBUG=True
LOGIN_REDIRECT_URL = '/login/'
# set dev-installed apps
DEV_INSTALLED_APPS = (
#'appname',
)
# enable or disable admins - uncomment and modify with your url
if ENABLE_ADMIN:
application_url_includes = patterns('',
#(r'^admin/(.*)', admin.site.root),
#(r'^custom/admin/dir/(.*)', include('webadmin.urls')),
)
else:
application_url_includes = patterns('',)
# choose the view for the root URL /
mastersite_rooturl = patterns('',
#url(r'^$', 'web.views.admin_redirect'),
url(r'^robots.txt','web.views.robots'),
url(r'^$', 'web.views.index', name="main_index"),
url(r'^(?P<linkname>\w+)/(?P<filtername>[\w-]+)', 'web.views.index'),
url(r'^(?P<linkname>\w+)','web.views.index')
)
# assuming mysql db, ENGINE = django.db.backends.mysql
DATABASES = {
'default': {
'ENGINE': '',
'NAME': 'db-name',
'HOST': '',
'PASSWORD': 'dbpassword',
'USER': 'db-user'
}
}
DATABASE_ENGINE = ''
DATABASE_NAME = ''
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
External Media & Templates¶
Here we will configure our templates, css/javascript & images directories. Comes with Twitter Bootstrap for default CSS & JS
- Place a symlink in sciweb/templates/domains containing any HTML templates or you can create the directory as well. Must be called “domains”
ln -s /directory/for/your/templates sciweb/templates/domains
- (optional) Create a directory called sciweb/static/domains add to .gitignore (must be called domains)
ln -s /directory/for/your/templates/static/ sciweb/static/domains
Default and Sub Templates¶
By default, there is a set of templates located inside sciweb/templates/
These templates are used if there is no subdirectory domains
inside of sciweb/templates
NOTE: Templates inside the subdirectories must contain the same naming as the default templates. so if you are accessing domain.com, and we have sciweb/templates/domains/domain.com/index.html, we will serve that file, otherwise, we serve the default sciweb/templates/index.html
Default Template Filenames¶
- index.html
- show_product.html
- show_article.html
- search.html
- products.html
- articles.html
Linked Media Subdirectories¶
Similar to the templates directory structure, we have a default directory sciweb/static
This directory is set with MEDIA_URL of /src/ (This can be overrided in local_settings.py)
As of 0.9, we will check for a sub directory inside of the static media directory settings.MEDIA_ROOT
called domains
If you are accessing domain.com, it will search for sciweb/static/domains/domain.com/
for any directories called bootstrap
If it is found, then it is used and overrides the default bootstrap files that are being used.
The user can choose to use {{MEDIA_URL}}/bootstrap/css/bootstrap.css
to use the default bootstrap.css file
TODO: Need to set the context processor to create a default static media variable usable in all templates which contains the link to the directory where media/template files are found. As of now, hardcoding the media urls into the HTML markup is required to explicitly access a file