Search code examples
pythondjangobashpython-venv

How to run manage.py inside venv?


I have been given an existing project to work on and I am really struggling to get the environment set up.

The project folder firstly contains manage.py server, which I use as an entry point to run the server.

There is also a venv folder which contains all the modules etc. I need.

So when I do runserver on manage.py, I get that "No module named sqlserver_ado.base". Even when I have activated the virtual environment and am in bash.... this module for instance is in venv folder in a venv\Lib\site-packages.

I am so very confused. I have also tried copying whatever modules are said to be missing and have ran into other issues this way also.


Solution

    1. run virtualenv venv in you desired directory
    2. after install from t run : source \your_folder\venv\bin\activate
    3. now you sohuld see (venv) before $ in the shell that mean you env is active
    4. install packages run pip install package_name
    5. run pip freeze to get installed packages
    6. go to project folder that include manage.py file
    7. run python manage.py runserver to make sure that evrything run fine

    to access django-shell run python manage.py shell