2015-09-18 19:22:55 +03:00
Getting Up and Running Locally
==============================
2015-09-19 00:26:29 +03:00
.. index :: pip, virtualenv, PostgreSQL
2015-09-18 19:22:55 +03:00
The steps below will get you up and running with a local development environment. We assume you have the following installed:
* pip
* virtualenv
* PostgreSQL
First make sure to create and activate a virtualenv_, then open a terminal at the project root and install the requirements for local development::
$ pip install -r requirements/local.txt
.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/
2015-10-07 19:50:21 +03:00
Then, create a PostgreSQL database with the following command, where `[repo_name]` is what value you entered for your project's `repo_name` ::
2015-09-18 19:22:55 +03:00
2015-10-07 19:51:18 +03:00
$ createdb [repo_name]
2015-09-18 19:22:55 +03:00
You can now run the usual Django `` migrate `` and `` runserver `` command::
$ python manage.py migrate
$ python manage.py runserver
**Setup your email backend**
django-allauth sends an email to verify users (and superusers) after signup and login (if they are still not verified). To send email you need to `configure your email backend`_
.. _configure your email backend: http://docs.djangoproject.com/en/1.8/topics/email/#smtp-backend
2015-11-18 14:16:25 +03:00
In development you can (optionally) use MailHog_ for email testing. MailHog is built with Go so there are no dependencies. To use MailHog::
2015-09-18 19:22:55 +03:00
2015-11-18 14:16:25 +03:00
1. `Download the latest release`_ for your operating system
2. Rename the executable to `` mailhog `` and copy it to the root of your project directory
3. Make sure it is executable (e.g. `` chmod +x mailhog `` )
.. _Mailhog: https://github.com/mailhog/MailHog/
.. _Download the latest release: https://github.com/mailhog/MailHog/releases
Alternatively simply output emails to the console via: `` EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' ``
2015-09-19 00:26:29 +03:00
2015-09-18 19:22:55 +03:00
In production basic email configuration is setup to send emails with Mailgun_
2015-09-19 00:26:29 +03:00
.. _Mailgun: https://www.mailgun.com/
2015-09-18 19:22:55 +03:00
**Live reloading and Sass CSS compilation**
If you'd like to take advantage of live reloading and Sass / Compass CSS compilation you can do so with the included Grunt task.
Make sure that nodejs_ is installed. Then in the project root run::
$ npm install
.. _nodejs: http://nodejs.org/download/
Now you just need::
$ grunt serve
The base app will now run as it would with the usual `` manage.py runserver `` but with live reloading and Sass compilation enabled.
To get live reloading to work you'll probably need to install an `appropriate browser extension`_
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
It's time to write the code!!!