Where to put project-specific Python code

Project specific applications can be placed in the root of the project - that'll just work out of the box. If there are many such apps that might be a bit messy though. 

However it's easy to add an extra directory to the PYTHONPATH, to do this in a more elegant way.

In the Dockerfile add: ENV PYTHONPATH /app/src:$PYTHONPATH. The beginning of the Dockerfile should look something like this:

 #   # Warning: text inside the DOCKER_FROM tags is auto-generated. Manual changes will be overwritten.
FROM aldryn/base-project:3.1.0
#

# add the "src" folder to the PYTHONPATH
ENV PYTHONPATH /app/src:$PYTHONPATH

#   # Warning: text inside the DOCKER_BUILD tags is auto-generated. Manual changes will be overwritten.

# node modules
[....]

After this change the Docker image will need to be rebuilt:

docker-compose build web

How to install external project dependencies

External project-specific requirements can be added to requirements.in. It is very similar to requirements.txt, but is preprocessed with the pip-compile command from pip-tools.

Make sure to place custom dependencies outside of the

# <INSTALLED_ADDONS>...

# </INSTALLED_ADDONS>

tags, since that part of the file is maintained automatically and is overwritten automatically with the requirements that were chosen in the UI.

You can use the package name, with an optional (but recommended) version number for example:

markdown=2.6.8

and you can use a version control system URL, such as:

https://github.com/some_account/some_repository/archive/master.tar.gz

In this case you need to use the tarball URL as in the example rather than the VCS URL.

For changes in this file to be picked up, rebuild the docker image: docker-compose build web.

Did this answer your question?