Lines 1-23
Link Here
|
1 |
********************************************************************** |
1 |
=============================================================================== |
2 |
|
2 |
|
3 |
To try out django CMS, open a shell and run the following commands: |
3 |
**************************************************************************** |
|
|
4 |
IMPORTANT / |
5 |
**************************************************************************** |
4 |
|
6 |
|
5 |
django-admin.py startproject mycmsproject |
7 |
If you're upgrading from a older version of py-django-cms please read the |
6 |
cd mycmsproject/mycmsproject |
8 |
upgrade instructions at: |
7 |
rm settings.py |
|
|
8 |
rm urls.py |
9 |
fetch https://gist.github.com/williambr/5748696/raw/settings.py |
10 |
fetch https://gist.github.com/raw/1125918/urls.py |
11 |
mkdir templates |
12 |
cd templates |
13 |
fetch https://gist.github.com/raw/1125918/example.html |
14 |
cd ../.. |
15 |
python manage.py syncdb --all |
16 |
python manage.py migrate --fake |
17 |
python manage.py runserver |
18 |
|
9 |
|
19 |
The last command should start a local server on port 8000 serving |
10 |
http://docs.django-cms.org/en/latest/upgrade/index.html |
20 |
your CMS installation, so open your browser and go to 127.0.0.1:8000 |
|
|
21 |
and you should see the CMS welcome page. |
22 |
|
11 |
|
23 |
********************************************************************** |
12 |
The described steps further down are a distilled version of "How to install |
|
|
13 |
django CMS by hand" which is available at: |
14 |
|
15 |
http://docs.django-cms.org/en/latest/how_to/install.html |
16 |
|
17 |
The manual gives enough information how to setup py-django-cms for |
18 |
development use. For production environments please consider to read the |
19 |
full documentation available at: |
20 |
|
21 |
http://docs.django-cms.org/en/latest/index.html |
22 |
|
23 |
**************************************************************************** |
24 |
1. Create a new Django project |
25 |
**************************************************************************** |
26 |
|
27 |
$ django-admin.py startproject myproject |
28 |
|
29 |
**************************************************************************** |
30 |
2. Edit settings.py |
31 |
**************************************************************************** |
32 |
|
33 |
--- Set a SITE_ID by adding the following line: |
34 |
|
35 |
SITE_ID = 1 # 1 will suffice in most cases |
36 |
|
37 |
--- Add the next lines to INSTALLED_APPS: |
38 |
|
39 |
'djangocms_admin_style' # must come BEFORE django.contrib.admin |
40 |
'django.contrib.sites' |
41 |
'cms' |
42 |
'menus' |
43 |
'sekizai' |
44 |
'treebeard' |
45 |
|
46 |
--- Configure the LANGUAGES and LANGUAGE_CODE, e.g.: |
47 |
|
48 |
LANGUAGES = [ |
49 |
('en', 'English'), |
50 |
('de', 'German'), |
51 |
] |
52 |
|
53 |
LANGUAGE_CODE = 'en' # For simplicity's sake at this stage it is worth |
54 |
# changing the default en-us in that you'll find in |
55 |
# the LANGUAGE_CODE setting to en. |
56 |
|
57 |
--- Add the following lines to MIDDLEWARE_CLASSES: |
58 |
|
59 |
'cms.middleware.utils.ApphookReloadMiddleware' # Optional, but useful |
60 |
'cms.middleware.user.CurrentUserMiddleware' |
61 |
'cms.middleware.page.CurrentPageMiddleware' |
62 |
'cms.middleware.toolbar.ToolbarMiddleware' |
63 |
'cms.middleware.language.LanguageCookieMiddleware' |
64 |
'django.middleware.locale.LocaleMiddleware' |
65 |
|
66 |
--- Add MEDIA_URL (where media files will be served) and MEDIA_ROOT (where they |
67 |
--- will be stored): |
68 |
|
69 |
MEDIA_URL = "/media/" |
70 |
MEDIA_ROOT = os.path.join(BASE_DIR, "media") |
71 |
|
72 |
--- See the Django documentation for guidance on serving media files in |
73 |
--- production. |
74 |
|
75 |
--- Add a CMS_TEMPLATES section that will be the project's default template: |
76 |
|
77 |
CMS_TEMPLATES = [ |
78 |
('home.html', 'Home page template'), |
79 |
] |
80 |
|
81 |
--- Add the next lines to TEMPLATES['OPTIONS']['context_processors']: |
82 |
|
83 |
'sekizai.context_processors.sekizai' |
84 |
'cms.context_processors.cms_settings' |
85 |
|
86 |
--- Django needs to be know where to look for its templates, so add following |
87 |
--- line (the appropriate directory will be created in the next step) to the |
88 |
----TEMPLATES['DIRS'] list: |
89 |
|
90 |
['templates'] |
91 |
|
92 |
--- In the root of the project, create a templates directory, and in that, |
93 |
--- home.html, a minimal django CMS template: |
94 |
|
95 |
{% load cms_tags sekizai_tags %} |
96 |
<html> |
97 |
<head> |
98 |
<title>{% page_attribute "page_title" %}</title> |
99 |
{% render_block "css" %} |
100 |
</head> |
101 |
<body> |
102 |
{% cms_toolbar %} |
103 |
{% placeholder "content" %} |
104 |
{% render_block "js" %} |
105 |
</body> |
106 |
</html> |
107 |
|
108 |
--- Note: See Django's template language documentation for more on how template |
109 |
--- inheritance works. |
110 |
|
111 |
**************************************************************************** |
112 |
3. Edit urls.py |
113 |
**************************************************************************** |
114 |
|
115 |
--- Edit urls.py and add url(r'^', include('cms.urls')) to the urlpatterns |
116 |
--- list. It should come after other patterns, so that specific URLs for other |
117 |
--- applications can be detected first. |
118 |
|
119 |
--- You'll also need to have an import for django.conf.urls.include and |
120 |
--- configure a media file serving for development purposes: |
121 |
|
122 |
from django.conf import settings |
123 |
from django.conf.urls import url, include |
124 |
from django.conf.urls.static import static |
125 |
|
126 |
urlpatterns = [ |
127 |
url(r'^admin/', admin.site.urls), |
128 |
url(r'^', include('cms.urls')), |
129 |
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
130 |
|
131 |
**************************************************************************** |
132 |
4. Setup the relational database backend |
133 |
**************************************************************************** |
134 |
|
135 |
--- For testing purpose SQLite can be used and it is configured by default |
136 |
--- in a new Django project's DATABASES. |
137 |
|
138 |
--- Refer to Django's DATABASES setting documentation for the appropriate |
139 |
--- configuration when PostgreSQL or MySQL are used as database backends. |
140 |
|
141 |
**************************************************************************** |
142 |
5. Run migrations to create database tables |
143 |
**************************************************************************** |
144 |
|
145 |
--- When a database backend has been choosen and set up properly, run the |
146 |
--- following command: |
147 |
|
148 |
$ python manage.py migrate |
149 |
|
150 |
**************************************************************************** |
151 |
6. Create an admin superuser |
152 |
**************************************************************************** |
153 |
|
154 |
--- For maintenance purposes it is necessary to create a admin user: |
155 |
|
156 |
$ python manage.py createsuperuser |
157 |
|
158 |
**************************************************************************** |
159 |
7. Check CMS installation |
160 |
**************************************************************************** |
161 |
|
162 |
--- This will check your configuration, your applications, your database and |
163 |
--- report on any problems: |
164 |
|
165 |
$ python manage.py cms check |
166 |
|
167 |
--- When there are no errors continue with the last step. |
168 |
|
169 |
**************************************************************************** |
170 |
8. Start the CMS |
171 |
**************************************************************************** |
172 |
|
173 |
--- The django CMS project will now run by issuing: |
174 |
|
175 |
$ python manage.py runserver |
176 |
|
177 |
--- The CMS can now be reached http://localhost:8000/ and the admin interface |
178 |
--- at http://localhost:8000/admin/ |
179 |
|
180 |
=============================================================================== |