[Django]-Django not working after moving directory. Do I have a path/Python installation issue?

1👍

Blind guess:

1) Did you activate your Virtual Environment? It sounds like manage.py couldn’t find the django installation.

2) Has the Environment Django installed?

3) Do you move the env itself?
The generated activate-script has hardcoded ( mine: e.g. VIRTUAL_ENV="/home/thomas/Intevation/env" ) paths in it. I would recommend to make a new env and install it there.

I encourage people to use: Pipenv


The traceback is a clear indicator, that wherever manage.py looks, is no django installed.

2👍

Late response, but I want to apport my workaround for this issue. Thanks to the Thomas response I understood the problem by looking at the activate script. So, was easier in my case restore the original path and follow these steps:

  1. Before to move the project and with the virtual environment activated

    pip freeze > requirements.txt

  2. Then deactivate the environment and remove it

    deactivate
    rm -rf .env

  3. Move the project to the desired directory

  4. Generate a fresh new virtual env and activate it

    python3 -m venv .env
    source .env/bin/activate

  5. Install the dependencies

    pip install -r requirements.txt

Leave a comment