restarted computer and got: ImportError: No module named django.core.management
Question: I have been having some issues with gulp serving my files so I restarted my
computer, upon going back to my project and starting the server I suddenly got
the error: `ImportError: No module named django.core.management`.

I am working locally and in my files I can see the django folder - it's path
is: `MAMP/Library/lib/python2.7/site-packages/mysql/connector/django`

The full error looks like this:

    
    
        Message:
        Command failed: /bin/sh -c ./manage.py runserver
    Traceback (most recent call last):
      File "./manage.py", line 11, in <module>
        from django.core.management import execute_from_command_line
    ImportError: No module named django.core.management
    
    Details:
        killed: false
        code: 1
        signal: null
        cmd: /bin/sh -c ./manage.py runserver
        stdout: 
        stderr: Traceback (most recent call last):
      File "./manage.py", line 11, in <module>
        from django.core.management import execute_from_command_line
    ImportError: No module named django.core.management
    

My manage.py looks like this:

    
    
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    from __future__ import unicode_literals
    
    import os
    import sys
    
    if __name__ == "__main__":
        os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tckt.settings")
    
        from django.core.management import execute_from_command_line
    
        execute_from_command_line(sys.argv)
    

running which python gives me this: `/usr/bin/python`

I am not sure if I am running in a virtual enviornment or not. I am doing the
front-end of this project, the enviornment was set up and installed by someone
else for me - but running `python -c 'import sys; print sys.real_prefix'
2>/dev/null && INVENV=1 || INVENV=0` (as another post suggested to check if I
was in a virtual enviornment) returned nothing.

I have looked through some of the other posts and see that some people have
reinstalled, others have modified paths, others say NOT to edit the manage.py
file - but since I am not really sure if the problem is the path or the
install I am not sure how to proceed.If you need more info please let me know.


Answer: You're missing python packages which means you're
[VirtualEnv](https://virtualenv.pypa.io/en/stable/) isn't activated.

[VirtualEnv](https://virtualenv.pypa.io/en/stable/) creates a folder named
`env` by default (though the name can be changed) which is where it stores the
specific python installation and all it's packages. Search for the `activate`
bash script in your project folder. Once you locate you can source it.

    
    
    source ./env/bin/activate
    

In the interest of completeness, in Windows it would be a batch file.

    
    
    env/bin/activate.bat
    

You'll know you're in a virtualenv when your command prompt is prefixed by the
env name, for example `(env) Macbook user$`.

You can now start your django test server.

    
    
    python manage.py runserver
    

To deactivate, simply type `deactivate` at any time in your command prompt.
The `(env)` prefix on the prompt should disappear.

