본문 바로가기

코딩/파이썬

django 가상환경 만들기

제일 먼저 가상환경 만드는 명령어는 cmd에서 이렇게 쳐준다.


python -m venv myvenv


(myvenv) C:\Users\admin\Documents\GitHub\my-first-blog>python manage.py runserver

Traceback (most recent call last):

  File "manage.py", line 8, in <module>

    from django.core.management import execute_from_command_line

ModuleNotFoundError: No module named 'django'


오류는 장고가 설치안되있다는 거 같다. 그래서 


(myvenv) C:\Users\admin\Documents\GitHub\my-first-blog>pip install "django<2"


이렇게 써주면 장고설치


Collecting django<2

  Cache entry deserialization failed, entry ignored

  Cache entry deserialization failed, entry ignored

  Downloading https://files.pythonhosted.org/packages/bf/e0/e659df5b5b82299fffd8b3df2910c99351b9308b8f45f5702cc4cdf946e9/Django-1.11.14-py2.py3-none-any.whl (7.0MB)

    100% |████████████████████████████████| 7.0MB 275kB/s

Collecting pytz (from django<2)

  Cache entry deserialization failed, entry ignored

  Cache entry deserialization failed, entry ignored

  Downloading https://files.pythonhosted.org/packages/30/4e/27c34b62430286c6d59177a0842ed90dc789ce5d1ed740887653b898779a/pytz-2018.5-py2.py3-none-any.whl (510kB)

    100% |████████████████████████████████| 512kB 2.8MB/s

Installing collected packages: pytz, django

Successfully installed django-1.11.14 pytz-2018.5

You are using pip version 9.0.3, however version 18.0 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command.


이런화면이 뜨면서 설치완료 후 서버를 뛰우면 잘 돌아간다