Setup with Virtualenv
You can run the Wagtail demo locally without setting up Vagrant or Docker and simply use Virtualenv, which is the recommended installation approach for Django itself.
Dependencies
- Python 3.4, 3.5 or 3.6
- Virtualenv
- VirtualenvWrapper (optional)
Installation
With PIP and virtualenvwrapper installed, run:
mkvirtualenv wagtailbakerydemo
python --version
Confirm that this is showing a compatible version of Python 3.x. If not, and you have multiple versions of Python installed on your system, you may need to specify the appropriate version when creating the virtualenv:
deactivate
rmvirtualenv wagtailbakerydemo
mkvirtualenv wagtailbakerydemo --python=python3.6
python --version
Now we're ready to set up the bakery demo project itself:
cd ~/dev [or your preferred dev directory]
git clone https://github.com/wagtail/bakerydemo.git
cd bakerydemo
pip install -r requirements/base.txt
Next, we'll set up our local environment variables. We use django-dotenv
to help with this. It reads environment variables located in a file name .env
in the top level directory of the project. The only variable we need to start is DJANGO_SETTINGS_MODULE
:
$ cp bakerydemo/settings/local.py.example bakerydemo/settings/local.py
$ echo "DJANGO_SETTINGS_MODULE=bakerydemo.settings.local" > .env
To set up your database and load initial data, run the following commands:
./manage.py migrate
./manage.py load_initial_data
./manage.py runserver
Log into the admin with the credentials admin / changeme
.
Setup with Docker
Dependencies
Installation
Run the following commands:
git clone https://github.com/wagtail/bakerydemo.git
cd bakerydemo
docker-compose up --build -d
docker-compose run app /venv/bin/python manage.py load_initial_data
docker-compose up
The demo site will now be accessible at http://localhost:8000/ and the Wagtail admin interface at http://localhost:8000/admin/.
Log into the admin with the credentials admin / changeme
.
Important: This docker-compose.yml
is configured for local testing only, and is not intended for production use.
Debugging
To tail the logs from the Docker containers in realtime, run:
docker-compose logs -f