33. Development Setup¶
33.1 Prerequisites¶
- you should have
postgresql-client-9.3
(or more recent) installed on the host. - you should be using at least docker v 1.2.
33.2 Docker Setup:¶
Run the postgis test server in docker:
docker build -t kartoza/postgis git://github.com/kartoza/docker-postgis
docker run --name="catalogue-postgis" \
--hostname="catalogue-postgis" \
--restart="always" -d -t kartoza/postgis
33.2.1 Load the dump:¶
Note: You should replace 172.17.0.89
with the IP address of your postgis container.
33.2.2 Run the development container.¶
This is a simple container with all deps installed in a venv under /home/web/catalogue and ssh.:
This will mount your django project directory into /home/web/catalogue/django_project
inside the container. The container will have a user whose gid and uid matches yours so that there are no permissions issues.
Note: The above setup is not intended to be secure - it is intended to provide a repeatable development environment.
33.3 Pycharm configuration¶
Now set up your pycharm so that you can work with your dev container as a 'remote' container.
First in File --> Settings --> Python Interpreter
add a remote interpreter with the following details:
- Host: localhost
- Port: 8001
- User name: docker
- Auth Type: Password
- Password: docker
- Python interpreter path:
/home/web/catalogue/venv/bin/python
Then setup your django integration in File --> Settings --> Django
:
- Django project root:
<path_to_project>/catalogue/django_project
- Settings:
core/settings/dev_<yourname>.py
- Manage script:
manage.py
Now set up your run configuration under Run -> Edit configurations
:
- Add a Django server configuration
- Host: 0.0.0.0
- Port: 8000
- Run in browser: http://localhost:8000/
- Environment variable: DJANGO_SETTINGS_MODULE=core.settings.dev_
(should be there automatically)