Improve installation instructions #122

Merged
merged 4 commits into from Jan 28, 2012
View
65 README.rst
@@ -101,6 +101,66 @@ can be used for creating a new Mezzanine project in a similar fashion to
$ mezzanine-project project_name
+Alternatively, if you have an existing Django project, you can install Mezzanine
+into it by the following steps (which assume experience with previous Django
+projects):
+
+* Add the following apps to your INSTALLED_APPS::
+
+ "django.contrib.comments",
+ "south",
+ "mezzanine.boot",
+ "mezzanine.conf",
+ "mezzanine.core",
+ "mezzanine.generic",
+ "mezzanine.blog",
+ "mezzanine.forms",
+ "mezzanine.pages",
+ "mezzanine.twitter",
+
+* Add the following to TEMPLATE_CONTEXT_PROCESSORS::
+
+ "django.core.context_processors.request",
+ "mezzanine.conf.context_processors.settings",
+
+ If the setting doesn't already exist, remember to start with the Django
+ defaults for your version of Django.
+
+* Modify MIDDLEWARE_CLASSES:
+
+ * Add "mezzanine.core.middleware.AdminLoginInterfaceSelector" to the end.
+
+ * You may want to replace Django's "UpdateCacheMiddleware" with
+ "mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware" and Django's
+ "FetchFromMiddleware" with
+ "mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware"
+
+* At the bottom of settings.py, add these lines::
+
+ PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
+ PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
+ from mezzanine.utils.conf import set_dynamic_settings
+ set_dynamic_settings(globals())
+
+* Modify your urls.py so that it contains the named URL 'home'::
+
+ from mezzanine.core.views import direct_to_template
+
+ urlpatterns = patterns("",
+ ...
+ url("^$", direct_to_template, {"template": "index.html"}, name="home"),
+ ...
+
+ and, *after* all your other URLs, the catch-all mezzanine handler::
+
+ ("^", include("mezzanine.urls")),
+
+
+* To make use of the CSS included with the default template,
+ copy the files from mezzanine/project_template/site_media to a folder
+ where they will be served as static files in your project.
+
+
You can then run your project with the usual Django steps::
$ cd project_name
@@ -109,8 +169,9 @@ You can then run your project with the usual Django steps::
.. note::
- The ``createdb`` command performs the same task as Django's ``syncdb``
- command, and also handles setting the initial migration state for `South`_.
+ The ``createdb`` is a shortcut for using Django's ``syncdb`` command and
+ setting the initial migration state for `South`_. You can alternatively use
+ ``syncdb`` and ``migrate`` as you normally would.
You should then be able to browse to http://127.0.0.1:8000/admin/ and log
in using the default account (``username: admin, password: default``). If
View
4 mezzanine/blog/migrations/0001_initial.py
@@ -6,6 +6,10 @@
class Migration(SchemaMigration):
+ depends_on = [
+ ("core", "0001_initial"),
+ ]
+
def forwards(self, orm):
# Adding model 'BlogPost'
View
3 mezzanine/core/management/__init__.py
@@ -5,6 +5,7 @@
from django.core.management import call_command
from django.db.models.signals import post_syncdb
+from mezzanine.forms.models import Form
from mezzanine.pages.models import Page
from mezzanine.pages import models as pages_app
@@ -23,7 +24,7 @@ def create_user(app, created_models, verbosity, interactive, **kwargs):
def create_pages(app, created_models, verbosity, interactive, **kwargs):
- if settings.DEBUG and Page in created_models:
+ if settings.DEBUG and Page in created_models and Form in created_models:
if interactive:
confirm = raw_input("\nWould you like to install some initial "
"content?\nEg: About page, Blog, Contact "
View
7 mezzanine/core/migrations/0002_auto__del_keyword.py
@@ -5,7 +5,12 @@
from django.db import models
class Migration(SchemaMigration):
-
+
+ depends_on = [
+ ('blog', '0006_auto__del_field_blogpost__keywords__add_field_blogpost_keywords_string'),
+ ('pages', '0002_auto__del_field_page__keywords__add_field_page_keywords_string__chg_fi'),
+ ]
+
def forwards(self, orm):
# Deleting model 'Keyword'
View
4 mezzanine/forms/migrations/0001_initial.py
@@ -6,6 +6,10 @@
class Migration(SchemaMigration):
+ depends_on = [
+ ('pages', '0001_initial'),
+ ]
+
def forwards(self, orm):
# Adding model 'Form'
View
21 mezzanine/forms/migrations/0003_auto__chg_field_field_field_type.py
@@ -8,13 +8,30 @@ class Migration(SchemaMigration):
def forwards(self, orm):
- # Changing field 'Field.field_type'
+ # Postgres throws error if trying to cast from varchar to integer field,
+ # so we convert in Python. Should be OK since Field table is unlikely to
+ # have many records.
+ data = list(orm['forms.Field'].objects.values_list('id', 'field_type'))
+
+ db.delete_column('forms_field', 'field_type')
+ db.add_column('forms_field', 'field_type', self.gf('django.db.models.fields.IntegerField')(null=True))
+
+ for pk, field_type in data:
+ orm['forms.Field'].objects.filter(id=pk).update(field_type=int(field_type))
+
db.alter_column('forms_field', 'field_type', self.gf('django.db.models.fields.IntegerField')())
def backwards(self, orm):
- # Changing field 'Field.field_type'
+ data = list(orm['forms.Field'].objects.values_list('id', 'field_type'))
+
+ db.delete_column('forms_field', 'field_type')
+ db.add_column('forms_field', 'field_type', self.gf('django.db.models.fields.CharField')(max_length=55, null=True))
+
+ for pk, field_type in data:
+ orm['forms.Field'].objects.filter(id=pk).update(field_type=str(field_type))
+
db.alter_column('forms_field', 'field_type', self.gf('django.db.models.fields.CharField')(max_length=55))
View
4 mezzanine/pages/migrations/0001_initial.py
@@ -6,6 +6,10 @@
class Migration(SchemaMigration):
+ depends_on = [
+ ('core', '0001_initial'),
+ ]
+
def forwards(self, orm):
# Adding model 'Page'