mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-04 05:24:45 +00:00
Merge pull request #986 from kaedroho/docs
Getting started docs changes
This commit is contained in:
commit
5a3431c9c3
8 changed files with 305 additions and 215 deletions
|
|
@ -1,148 +1,81 @@
|
|||
=====================
|
||||
Creating your project
|
||||
=====================
|
||||
===========================
|
||||
Starting your first project
|
||||
===========================
|
||||
|
||||
.. contents:: Contents
|
||||
:local:
|
||||
Once you've installed Wagtail, you are ready start your first project. Wagtail projects are ordinary Django projects with a few extra apps installed.
|
||||
|
||||
|
||||
The ``wagtail start`` command
|
||||
=============================
|
||||
|
||||
The easiest way to start a new project with wagtail is to use the ``wagtail start`` command. This command is installed into your environment when you install Wagtail (see: :doc:`installation`).
|
||||
|
||||
The command works the same way as ``django-admin.py startproject`` except that the produced project is pre-configured for Wagtail. It also contains some useful extras which we will look at in the next section.
|
||||
|
||||
To create a project, cd into a directory where you would like to create your project and run the following command:
|
||||
Wagtail provides a command to get you started called ``wagtail start``. Open up a command line shell in your project folder and type:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wagtail start mysite
|
||||
|
||||
|
||||
The project
|
||||
===========
|
||||
|
||||
Lets look at what ``wagtail start`` created::
|
||||
|
||||
mysite/
|
||||
core/
|
||||
static/
|
||||
templates/
|
||||
base.html
|
||||
404.html
|
||||
500.html
|
||||
mysite/
|
||||
settings/
|
||||
base.py
|
||||
dev.py
|
||||
production.py
|
||||
manage.py
|
||||
vagrant/
|
||||
provision.sh
|
||||
Vagrantfile
|
||||
readme.rst
|
||||
requirements.txt
|
||||
|
||||
|
||||
The "core" app
|
||||
----------------
|
||||
|
||||
Location: ``/mysite/core/``
|
||||
|
||||
This app is here to help get you started quicker by providing a ``HomePage`` model with migrations to create one when you first setup your app.
|
||||
This should create a new folder called ``mysite``. Its contents are similar to what ``django-admin.py startproject`` creates but ``wagtail start`` comes with some useful extras that are documented :doc:`here <../reference/project_template>`.
|
||||
|
||||
|
||||
Default templates and static files
|
||||
----------------------------------
|
||||
Running it
|
||||
==========
|
||||
|
||||
Location: ``/mysite/core/templates/`` and ``/mysite/core/static/``
|
||||
|
||||
The templates directory contains ``base.html``, ``404.html`` and ``500.html``. These files are very commonly needed on Wagtail sites to they have been added into the template.
|
||||
|
||||
The static directory contains an empty javascript and sass file. Wagtail uses ``django-compressor`` for compiling and compressing static files. For more information, see: `Django Compressor Documentation <http://django-compressor.readthedocs.org/en/latest/>`_
|
||||
Firstly, open up a command line shell in your new projects directory.
|
||||
|
||||
|
||||
Vagrant configuration
|
||||
---------------------
|
||||
* **1. Create a virtual environment**
|
||||
|
||||
Location: ``/Vagrantfile`` and ``/vagrant/``
|
||||
This is only required when you first run your project. This creates a folder to install extra Python modules into.
|
||||
|
||||
If you have Vagrant installed, these files let you easily setup a development environment with PostgreSQL and Elasticsearch inside a virtual machine.
|
||||
**Linux/Mac OSX:** :code:`pyvenv venv`
|
||||
|
||||
See below section `With Vagrant`_ for info on how to use Vagrant in development
|
||||
|
||||
If you do not want to use Vagrant, you can just delete these files.
|
||||
**Windows:** :code:`c:\Python34\python -m venv myenv`
|
||||
|
||||
|
||||
Django settings
|
||||
---------------
|
||||
|
||||
Location: ``/mysite/mysite/settings/``
|
||||
|
||||
The Django settings files are split up into ``base.py``, ``dev.py``, ``production.py`` and ``local.py``.
|
||||
|
||||
.. glossary::
|
||||
|
||||
``base.py``
|
||||
|
||||
This file is for global settings that will be used in both development and production. Aim to keep most of your configuration in this file.
|
||||
|
||||
``dev.py``
|
||||
|
||||
This file is for settings that will only be used by developers. For example: ``DEBUG = True``
|
||||
|
||||
``production.py``
|
||||
|
||||
This file is for settings that will only run on a production server. For example: ``DEBUG = False``
|
||||
|
||||
``local.py``
|
||||
|
||||
This file is used for settings local to a particular machine. This file should never be tracked by a version control system.
|
||||
|
||||
.. tip::
|
||||
|
||||
On production servers, we recommend that you only store secrets in local.py (such as API keys and passwords). This can save you headaches in the future if you are ever trying to debug why a server is behaving badly. If you are using multiple servers which need different settings then we recommend that you create a different ``production.py`` file for each one.
|
||||
https://docs.python.org/3/library/venv.html
|
||||
|
||||
|
||||
Getting it running
|
||||
==================
|
||||
**Python 2.7**
|
||||
|
||||
``pyvenv`` is only included with Python 3.3 onwards. To get virtual environments on Python 2, use the ``virtualenv`` package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install virtualenv
|
||||
virtualenv venv
|
||||
|
||||
|
||||
With Vagrant
|
||||
------------
|
||||
* **2. Activate the virtual environment**
|
||||
|
||||
This is the easiest way to get the project running. Vagrant runs your project locally in a virtual machine so you can use PostgreSQL and Elasticsearch in development without having to install them on your host machine. If you haven't yet installed Vagrant, see: `Installing Vagrant <https://docs.vagrantup.com/v2/installation/>`_.
|
||||
**Linux/Mac OSX:** :code:`source venv/bin/activate`
|
||||
|
||||
**Windows:** :code:`venv/Scripts/activate.bat`
|
||||
|
||||
https://docs.python.org/3/library/venv.html
|
||||
|
||||
|
||||
To setup the Vagrant box, run the following commands
|
||||
* **3. Install PIP requirements**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
vagrant up # This may take some time on first run
|
||||
vagrant ssh
|
||||
# within the ssh session
|
||||
dj createsuperuser
|
||||
djrun
|
||||
:code:`pip install -r requirements.txt`
|
||||
|
||||
|
||||
If you now visit http://localhost:8000 you should see a very basic "Welcome to your new Wagtail site!" page.
|
||||
* **4. Create the database**
|
||||
|
||||
You can browse the Wagtail admin interface at: http://localhost:8000/admin
|
||||
By default, this would create an SQLite database file within the project directory.
|
||||
|
||||
You can read more about how Vagrant works at: https://docs.vagrantup.com/v2/
|
||||
:code:`python manage.py migrate`
|
||||
|
||||
|
||||
.. topic:: The ``dj`` and ``djrun`` aliases
|
||||
* **5. Create an admin user**
|
||||
|
||||
When using Vagrant, the Wagtail template provides two aliases: ``dj`` and ``djrun`` which can be used in the ``vagrant ssh`` session.
|
||||
:code:`python manage.py createsuperuser`
|
||||
|
||||
.. glossary::
|
||||
|
||||
``dj``
|
||||
|
||||
This is short for ``python manage.py`` so you can use it to reduce typing. For example: ``python manage.py syncdb`` becomes ``dj syncdb``.
|
||||
* **6. Run the development server**
|
||||
|
||||
``djrun``
|
||||
|
||||
This is short for ``python manage.py runserver 0.0.0.0:8000``. This is used to run the testing server which is accessible from ``http://localhost:8000`` (note that the port number gets changed by Vagrant)
|
||||
:code:`python manage.py runserver`
|
||||
|
||||
Your site is now accessible at ``http://localhost:8000``, with the admin backend available at ``http://localhost:8000/admin/``.
|
||||
|
||||
|
||||
Using Vagrant
|
||||
-------------
|
||||
|
||||
:doc:`using_vagrant`
|
||||
|
|
|
|||
|
|
@ -5,5 +5,7 @@ Getting started
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
trying_wagtail
|
||||
installation
|
||||
creating_your_project
|
||||
using_vagrant
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
|
||||
Before you start
|
||||
================
|
||||
|
||||
|
|
@ -10,75 +11,46 @@ A basic Wagtail setup can be installed on your machine with only a few prerequis
|
|||
Whether you just want to try out the demo site, or you're ready to dive in and create a Wagtail site with all bells and whistles enabled, we strongly recommend the Vagrant approach. Nevertheless, if you're the sort of person who balks at the idea of downloading a whole operating system just to run a web app, we've got you covered too. Start from `A basic Wagtail installation`_ below.
|
||||
|
||||
|
||||
The demo site (a.k.a. the no-installation route)
|
||||
================================================
|
||||
Install Python
|
||||
==============
|
||||
|
||||
We provide a demo site containing a set of standard templates and page types - if you're new to Wagtail, this is the best way to try it out and familiarise yourself with how Wagtail works from the point of view of an editor.
|
||||
|
||||
If you're happy to use Vagrant, and you just want to set up the Wagtail demo site, or any other pre-existing Wagtail site that ships with Vagrant support, you don't need to install Wagtail at all. Install `Vagrant <http://www.vagrantup.com/>`__ and `VirtualBox <https://www.virtualbox.org/>`__, and run::
|
||||
|
||||
git clone https://github.com/torchbox/wagtaildemo.git
|
||||
cd wagtaildemo
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
If you haven't got Python installed yet, we recommend installing Python 3.4. You can find the download for it here: https://www.python.org/downloads/
|
||||
|
||||
|
||||
Then, within the SSH session::
|
||||
pip
|
||||
---
|
||||
|
||||
./manage.py createsuperuser
|
||||
./manage.py runserver 0.0.0.0:8000
|
||||
Python 3.4 has this built in. If you are using Python 2.7 or 3.3, you will have to install PIP separately
|
||||
|
||||
See: https://pip.pypa.io/en/latest/installing.html
|
||||
|
||||
|
||||
This will make the demo site available on your host machine at the URL http://localhost:8000/ - you can access the Wagtail admin interface at http://localhost:8000/admin/ . Further instructions can be found at :ref:`editor_manual`.
|
||||
Virtual environments
|
||||
--------------------
|
||||
|
||||
Once you’ve experimented with the demo site and are ready to build your own site, it's time to install Wagtail on your host machine. Even if you intend to do all further Wagtail work within Vagrant, installing the Wagtail package on your host machine will provide the ``wagtail start`` command that sets up the initial file structure for your project.
|
||||
Python 3.3 and 3.4 has this built in. If you are using Python 2.7 you will have to install the ``virtualenv`` package from pip:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install virtualenv
|
||||
|
||||
|
||||
A basic Wagtail installation
|
||||
============================
|
||||
Install Wagtail
|
||||
===============
|
||||
|
||||
This provides everything you need to create a new Wagtail project from scratch, containing no page definitions or templates other than a basic homepage as a starting point for building your site. (For a gentler introduction to Wagtail, you may wish to try out the demo site first!)
|
||||
Wagtail is available as a pip-installable package. To get the latest stable version:
|
||||
|
||||
You will need Python's `pip <http://pip.readthedocs.org/en/latest/installing.html>`__ package manager. We also recommend `virtualenvwrapper <http://virtualenvwrapper.readthedocs.org/en/latest/>`_ so that you can manage multiple independent Python environments for different projects - although this is not strictly necessary if you intend to do all your development under Vagrant.
|
||||
|
||||
Wagtail is based on the Django web framework and various other Python libraries. Most of these are pure Python and will install automatically using ``pip``, but there are a few native-code components that require further attention:
|
||||
|
||||
* libsass-python (for compiling SASS stylesheets) - requires a C++ compiler and the Python development headers.
|
||||
* Pillow (for image processing) - additionally requires libjpeg and zlib.
|
||||
|
||||
On Debian or Ubuntu, these can be installed with the command::
|
||||
|
||||
sudo apt-get install python-dev python-pip g++ libjpeg62-dev zlib1g-dev
|
||||
|
||||
With these dependencies installed, Wagtail can then be installed with the command::
|
||||
.. code-block:: bash
|
||||
|
||||
pip install wagtail
|
||||
|
||||
(or if you're not using virtualenvwrapper: ``sudo pip install wagtail``.)
|
||||
|
||||
You will now be able to run the following command to set up an initial file structure for your Wagtail project (replace ``myprojectname`` with a name of your choice)::
|
||||
To check that Wagtail can be seen by Python. Type ``python`` in your shell then try to import ``wagtail`` from the prompt:
|
||||
|
||||
wagtail start myprojectname
|
||||
.. code-block:: python
|
||||
|
||||
**Without Vagrant:** Run the following steps to complete setup of your project (the ``createsuperuser`` step will prompt you to set up a superuser account)::
|
||||
>>> import wagtail
|
||||
|
||||
cd myprojectname
|
||||
pip install -r requirements.txt
|
||||
python manage.py migrate
|
||||
python manage.py createsuperuser
|
||||
python manage.py runserver
|
||||
|
||||
Your site is now accessible at http://localhost:8000, with the admin backend available at http://localhost:8000/admin/ .
|
||||
|
||||
**With Vagrant:** Run the following steps to bring up the virtual machine and complete setup of your project (the ``createsuperuser`` step will prompt you to set up a superuser account)::
|
||||
|
||||
cd myprojectname
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
./manage.py createsuperuser
|
||||
./manage.py runserver 0.0.0.0:8000
|
||||
|
||||
Your site is now accessible at http://localhost:8000, with the admin backend available at http://localhost:8000/admin/ .
|
||||
|
||||
Optional extras
|
||||
===============
|
||||
|
|
@ -104,6 +76,7 @@ This assumes that your PostgreSQL instance is configured to allow you to connect
|
|||
|
||||
ElasticSearch
|
||||
-------------
|
||||
|
||||
Wagtail integrates with ElasticSearch to provide full-text searching of your content, both within the Wagtail interface and on your site's front-end. If ElasticSearch is not available, Wagtail will fall back to much more basic search functionality using database queries. ElasticSearch is pre-installed as part of the Vagrant virtual machine image; non-Vagrant users can use the `debian.sh <https://github.com/torchbox/wagtail/blob/master/scripts/install/debian.sh>`__ or `ubuntu.sh <https://github.com/torchbox/wagtail/blob/master/scripts/install/ubuntu.sh>`__ installation scripts as a guide.
|
||||
|
||||
To enable ElasticSearch for your project, uncomment the ``elasticsearch`` line from your project's requirements.txt, and in ``myprojectname/settings/base.py``, uncomment the WAGTAILSEARCH_BACKENDS section. Then run::
|
||||
|
|
@ -115,52 +88,3 @@ To enable ElasticSearch for your project, uncomment the ``elasticsearch`` line f
|
|||
Image feature detection
|
||||
-----------------------
|
||||
Wagtail can use the OpenCV computer vision library to detect faces and other features in images, and use this information to select the most appropriate centre point when cropping the image. OpenCV is pre-installed as part of the Vagrant virtual machine image, and Vagrant users can enable this by setting ``WAGTAILIMAGES_FEATURE_DETECTION_ENABLED`` to True in ``myprojectname/settings/base.py``. For installation outside of Vagrant, see :ref:`image_feature_detection`.
|
||||
|
||||
|
||||
Alternative installation methods
|
||||
================================
|
||||
|
||||
Ubuntu
|
||||
------
|
||||
|
||||
If you have a fresh instance of Ubuntu 13.04 or later, you can install Wagtail,
|
||||
along with a demonstration site containing a set of standard templates and page
|
||||
types, in one step. As the root user::
|
||||
|
||||
curl -O https://raw.githubusercontent.com/torchbox/wagtail/master/scripts/install/ubuntu.sh; bash ubuntu.sh
|
||||
|
||||
This script installs all the dependencies for a production-ready Wagtail site,
|
||||
including PostgreSQL, Redis, Elasticsearch, Nginx and uwsgi. We
|
||||
recommend you check through the script before running it, and adapt it according
|
||||
to your deployment preferences. The canonical version is at
|
||||
`github.com/torchbox/wagtail/blob/master/scripts/install/ubuntu.sh
|
||||
<https://github.com/torchbox/wagtail/blob/master/scripts/install/ubuntu.sh>`_.
|
||||
|
||||
|
||||
Debian
|
||||
------
|
||||
|
||||
If you have a fresh instance of Debian 7, you can install Wagtail, along with a
|
||||
demonstration site containing a set of standard templates and page types, in one
|
||||
step. As the root user::
|
||||
|
||||
curl -O https://raw.githubusercontent.com/torchbox/wagtail/master/scripts/install/debian.sh; bash debian.sh
|
||||
|
||||
This script installs all the dependencies for a production-ready Wagtail site,
|
||||
including PostgreSQL, Redis, Elasticsearch, Nginx and uwsgi. We
|
||||
recommend you check through the script before running it, and adapt it according
|
||||
to your deployment preferences. The canonical version is at
|
||||
`github.com/torchbox/wagtail/blob/master/scripts/install/debian.sh
|
||||
<https://github.com/torchbox/wagtail/blob/master/scripts/install/debian.sh>`_.
|
||||
|
||||
Docker
|
||||
------
|
||||
|
||||
`@oyvindsk <https://github.com/oyvindsk>`_ has built a Dockerfile for the Wagtail demo. Simply run::
|
||||
|
||||
docker run -p 8000:8000 -d oyvindsk/wagtail-demo
|
||||
|
||||
then access the site at http://your-ip:8000 and the admin
|
||||
interface at http://your-ip:8000/admin using admin / test.
|
||||
|
||||
See https://index.docker.io/u/oyvindsk/wagtail-demo/ for more details.
|
||||
|
|
|
|||
78
docs/getting_started/trying_wagtail.rst
Normal file
78
docs/getting_started/trying_wagtail.rst
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
==============
|
||||
Trying Wagtail
|
||||
==============
|
||||
|
||||
|
||||
Wagtail demo
|
||||
============
|
||||
|
||||
We provide a demo site containing a set of standard templates and page types - if you're new to Wagtail, this is the best way to try it out and familiarise yourself with how Wagtail works from the point of view of an editor.
|
||||
|
||||
If you're happy to use Vagrant, and you just want to set up the Wagtail demo site, or any other pre-existing Wagtail site that ships with Vagrant support, you don't need to install Wagtail at all. Install `Vagrant <http://www.vagrantup.com/>`__ and `VirtualBox <https://www.virtualbox.org/>`__, and run::
|
||||
|
||||
git clone https://github.com/torchbox/wagtaildemo.git
|
||||
cd wagtaildemo
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
|
||||
|
||||
Then, within the SSH session::
|
||||
|
||||
./manage.py createsuperuser
|
||||
./manage.py runserver 0.0.0.0:8000
|
||||
|
||||
|
||||
This will make the demo site available on your host machine at the URL http://localhost:8000/ - you can access the Wagtail admin interface at http://localhost:8000/admin/ . Further instructions can be found at :ref:`editor_manual`.
|
||||
|
||||
Once you’ve experimented with the demo site and are ready to build your own site, it's time to install Wagtail on your host machine. Even if you intend to do all further Wagtail work within Vagrant, installing the Wagtail package on your host machine will provide the ``wagtail start`` command that sets up the initial file structure for your project.
|
||||
|
||||
|
||||
One line install
|
||||
================
|
||||
|
||||
|
||||
Ubuntu
|
||||
------
|
||||
|
||||
If you have a fresh instance of Ubuntu 13.04 or later, you can install Wagtail,
|
||||
along with a demonstration site containing a set of standard templates and page
|
||||
types, in one step. As the root user::
|
||||
|
||||
curl -O https://raw.githubusercontent.com/torchbox/wagtail/master/scripts/install/ubuntu.sh; bash ubuntu.sh
|
||||
|
||||
This script installs all the dependencies for a production-ready Wagtail site,
|
||||
including PostgreSQL, Redis, Elasticsearch, Nginx and uwsgi. We
|
||||
recommend you check through the script before running it, and adapt it according
|
||||
to your deployment preferences. The canonical version is at
|
||||
`github.com/torchbox/wagtail/blob/master/scripts/install/ubuntu.sh
|
||||
<https://github.com/torchbox/wagtail/blob/master/scripts/install/ubuntu.sh>`_.
|
||||
|
||||
|
||||
Debian
|
||||
------
|
||||
|
||||
If you have a fresh instance of Debian 7, you can install Wagtail, along with a
|
||||
demonstration site containing a set of standard templates and page types, in one
|
||||
step. As the root user::
|
||||
|
||||
curl -O https://raw.githubusercontent.com/torchbox/wagtail/master/scripts/install/debian.sh; bash debian.sh
|
||||
|
||||
This script installs all the dependencies for a production-ready Wagtail site,
|
||||
including PostgreSQL, Redis, Elasticsearch, Nginx and uwsgi. We
|
||||
recommend you check through the script before running it, and adapt it according
|
||||
to your deployment preferences. The canonical version is at
|
||||
`github.com/torchbox/wagtail/blob/master/scripts/install/debian.sh
|
||||
<https://github.com/torchbox/wagtail/blob/master/scripts/install/debian.sh>`_.
|
||||
|
||||
|
||||
Docker
|
||||
======
|
||||
|
||||
`@oyvindsk <https://github.com/oyvindsk>`_ has built a Dockerfile for the Wagtail demo. Simply run::
|
||||
|
||||
docker run -p 8000:8000 -d oyvindsk/wagtail-demo
|
||||
|
||||
then access the site at http://your-ip:8000 and the admin
|
||||
interface at http://your-ip:8000/admin using admin / test.
|
||||
|
||||
See https://index.docker.io/u/oyvindsk/wagtail-demo/ for more details.
|
||||
37
docs/getting_started/using_vagrant.rst
Normal file
37
docs/getting_started/using_vagrant.rst
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
Using Vagrant
|
||||
=============
|
||||
|
||||
This is the easiest way to get the project running. Vagrant runs your project locally in a virtual machine so you can use PostgreSQL and Elasticsearch in development without having to install them on your host machine. If you haven't yet installed Vagrant, see: `Installing Vagrant <https://docs.vagrantup.com/v2/installation/>`_.
|
||||
|
||||
|
||||
To setup the Vagrant box, run the following commands
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
vagrant up # This may take some time on first run
|
||||
vagrant ssh
|
||||
# within the ssh session
|
||||
dj createsuperuser
|
||||
djrun
|
||||
|
||||
|
||||
If you now visit http://localhost:8000 you should see a very basic "Welcome to your new Wagtail site!" page.
|
||||
|
||||
You can browse the Wagtail admin interface at: http://localhost:8000/admin
|
||||
|
||||
You can read more about how Vagrant works at: https://docs.vagrantup.com/v2/
|
||||
|
||||
|
||||
.. topic:: The ``dj`` and ``djrun`` aliases
|
||||
|
||||
When using Vagrant, the Wagtail template provides two aliases: ``dj`` and ``djrun`` which can be used in the ``vagrant ssh`` session.
|
||||
|
||||
.. glossary::
|
||||
|
||||
``dj``
|
||||
|
||||
This is short for ``python manage.py`` so you can use it to reduce typing. For example: ``python manage.py syncdb`` becomes ``dj syncdb``.
|
||||
|
||||
``djrun``
|
||||
|
||||
This is short for ``python manage.py runserver 0.0.0.0:8000``. This is used to run the testing server which is accessible from ``http://localhost:8000`` (note that the port number gets changed by Vagrant)
|
||||
|
|
@ -1,12 +1,44 @@
|
|||
Welcome to Wagtail's documentation
|
||||
==================================
|
||||
|
||||
Wagtail is a modern, flexible CMS, built on Django.
|
||||
Wagtail is an open source CMS written in `Python <https://www.python.org/>`_ and built on the `Django web framework <https://www.djangoproject.com/>`_.
|
||||
|
||||
Below are some useful links to help you get started with Wagtail.
|
||||
|
||||
|
||||
* **First steps**
|
||||
|
||||
:doc:`getting_started/trying_wagtail`
|
||||
|
||||
:doc:`getting_started/installation`
|
||||
|
||||
:doc:`getting_started/creating_your_project`
|
||||
|
||||
|
||||
* **Creating your Wagtail site**
|
||||
|
||||
:doc:`core_components/pages/creating_pages`
|
||||
|
||||
:doc:`Writing templates <core_components/pages/writing_templates>`
|
||||
|
||||
:doc:`core_components/images/index`
|
||||
|
||||
:doc:`core_components/search/index`
|
||||
|
||||
:doc:`howto/third_party_tutorials`
|
||||
|
||||
|
||||
* **Using Wagtail**
|
||||
|
||||
:doc:`Editors guide <editor_manual/index>`
|
||||
|
||||
|
||||
Index
|
||||
-----
|
||||
|
||||
It supports Django 1.7.0+ on Python 2.7, 3.3 and 3.4.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
:maxdepth: 2
|
||||
:titlesonly:
|
||||
|
||||
getting_started/index
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ Reference
|
|||
:maxdepth: 2
|
||||
|
||||
management_commands
|
||||
project_template
|
||||
|
|
|
|||
83
docs/reference/project_template.rst
Normal file
83
docs/reference/project_template.rst
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
The project template
|
||||
====================
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
mysite/
|
||||
core/
|
||||
static/
|
||||
templates/
|
||||
base.html
|
||||
404.html
|
||||
500.html
|
||||
mysite/
|
||||
settings/
|
||||
base.py
|
||||
dev.py
|
||||
production.py
|
||||
manage.py
|
||||
vagrant/
|
||||
provision.sh
|
||||
Vagrantfile
|
||||
readme.rst
|
||||
requirements.txt
|
||||
|
||||
|
||||
The "core" app
|
||||
----------------
|
||||
|
||||
Location: ``/mysite/core/``
|
||||
|
||||
This app is here to help get you started quicker by providing a ``HomePage`` model with migrations to create one when you first setup your app.
|
||||
|
||||
|
||||
Default templates and static files
|
||||
----------------------------------
|
||||
|
||||
Location: ``/mysite/core/templates/`` and ``/mysite/core/static/``
|
||||
|
||||
The templates directory contains ``base.html``, ``404.html`` and ``500.html``. These files are very commonly needed on Wagtail sites to they have been added into the template.
|
||||
|
||||
The static directory contains an empty javascript and sass file. Wagtail uses ``django-compressor`` for compiling and compressing static files. For more information, see: `Django Compressor Documentation <http://django-compressor.readthedocs.org/en/latest/>`_
|
||||
|
||||
|
||||
Vagrant configuration
|
||||
---------------------
|
||||
|
||||
Location: ``/Vagrantfile`` and ``/vagrant/``
|
||||
|
||||
If you have Vagrant installed, these files let you easily setup a development environment with PostgreSQL and Elasticsearch inside a virtual machine.
|
||||
|
||||
See :doc:`../getting_started/using_vagrant` for info on how to use Vagrant in development
|
||||
|
||||
If you do not want to use Vagrant, you can just delete these files.
|
||||
|
||||
|
||||
Django settings
|
||||
---------------
|
||||
|
||||
Location: ``/mysite/mysite/settings/``
|
||||
|
||||
The Django settings files are split up into ``base.py``, ``dev.py``, ``production.py`` and ``local.py``.
|
||||
|
||||
.. glossary::
|
||||
|
||||
``base.py``
|
||||
|
||||
This file is for global settings that will be used in both development and production. Aim to keep most of your configuration in this file.
|
||||
|
||||
``dev.py``
|
||||
|
||||
This file is for settings that will only be used by developers. For example: ``DEBUG = True``
|
||||
|
||||
``production.py``
|
||||
|
||||
This file is for settings that will only run on a production server. For example: ``DEBUG = False``
|
||||
|
||||
``local.py``
|
||||
|
||||
This file is used for settings local to a particular machine. This file should never be tracked by a version control system.
|
||||
|
||||
.. tip::
|
||||
|
||||
On production servers, we recommend that you only store secrets in local.py (such as API keys and passwords). This can save you headaches in the future if you are ever trying to debug why a server is behaving badly. If you are using multiple servers which need different settings then we recommend that you create a different ``production.py`` file for each one.
|
||||
Loading…
Reference in a new issue