카테고리 없음
Django로 웹프로젝트 만들기
구라미
2019. 12. 1. 22:21
계속 Python3에 문제가 있어서 django 패키지가 설치도 안되고 계속 문제가 생겨서
업데이트를 했는데 homebrew로 3.7버전으로 업데이트 했는데 iterm으로 버전을 확인해보면 자꾸 3.5.1이라고 되어있어서 답답했다.
뭔가 버전 충돌, 먼저 설치된 파이썬 문제인거 같은데 응용프로그램에서 파이썬을 삭제해도 계속 3.5.1이 삭제되지 않고 남아있어 패키지 설치도 안되고 .....흑흑
그래서 python3
/Library/Frameworks/Python.framework 라는 경로를 찾아서 위치와 버전을 확인한후 재설치 하였다.
아래와 같은 코드를 쳐서 기존의 python을 삭제하였음..
sudo rm -rf /Library/Frameworks/Python.framework/Versions/3.5
출처: https://yesitis.tistory.com/5 [Time is on my side]
참고한 포스트 : https://yesitis.tistory.com/5
HOMEBREW로 파이썬 설치
맥용 패키지 관리는 홈브루를 통해 하는 게 좋다고 해서 잔존해있던 파이썬을 삭제하고 홈브루로 설치하였다.
Last login: Sun Dec 1 21:58:01 on ttys000
➜ ~ git:(master) ✗ python3 --version
zsh: command not found: python3
➜ ~ git:(master) ✗ python3 -version
zsh: command not found: python3
➜ ~ git:(master) ✗ brew install python3
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.5.mojave.bottle.
Already downloaded: /Users/ha-eun/Library/Caches/Homebrew/downloads/7794177f83ae954016ce1dcdffbbea049e471017b473f3ed7cba6c3eee1bdc33--python-3.7.5.mojave.bottle.tar.gz
==> Pouring python-3.7.5.mojave.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install
==> /usr/local/Cellar/python/3.7.5/bin/python3 -s setup.py --no-user-cfg install
==> Caveats
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
If you need Homebrew's Python 2.7 run
brew install python@2
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.7/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /usr/local/Cellar/python/3.7.5: 3,972 files, 60.7MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/ha-eun/Library/Caches/Homebrew/icu4c--64.2.mojave.bottle.tar.gz... (26.1MB)
Removing: /Users/ha-eun/Library/Caches/Homebrew/node--12.6.0.mojave.bottle.tar.gz... (14.7MB)
Removing: /usr/local/Cellar/readline/7.0.5... (46 files, 1.5MB)
Removing: /Users/ha-eun/Library/Caches/Homebrew/yarn--1.17.3.tar.gz... (1.2MB)
Removing: /Users/ha-eun/Library/Logs/Homebrew/icu4c... (64B)
Removing: /Users/ha-eun/Library/Logs/Homebrew/yarn... (100B)
Removing: /Users/ha-eun/Library/Logs/Homebrew/node... (64B)
Pruned 12 symbolic links and 2 directories from /usr/local
➜ ~ git:(master) ✗ cd djangogirls
➜ djangogirls git:(master) ✗ python3 -m venv mvenv
Error: [Errno 2] No such file or directory: '/Users/ha-eun/djangogirls/mvenv/bin/python3': '/Users/ha-eun/djangogirls/mvenv/bin/python3'
➜ djangogirls git:(master) ✗ python3 -m venv mvenv
Error: [Errno 2] No such file or directory: '/Users/ha-eun/djangogirls/mvenv/bin/python3': '/Users/ha-eun/djangogirls/mvenv/bin/python3'
➜ djangogirls git:(master) ✗ python3 -m venv myvenv
Error: [Errno 2] No such file or directory: '/Users/ha-eun/djangogirls/myvenv/bin/python3': '/Users/ha-eun/djangogirls/myvenv/bin/python3'
➜ djangogirls git:(master) ✗ python3 -m venv myvenv
➜ djangogirls git:(master) ✗ source myvenv/bin/activate
(myvenv) ➜ djangogirls git:(master) ✗ python3 -m pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Successfully installed pip-19.3.1
(myvenv) ➜ djangogirls git:(master) ✗ pip3 install django
Collecting django
Using cached https://files.pythonhosted.org/packages/a0/36/463632a2e9161a7e713488d719a280e8cb0c7e3a66ed32a32e801891caae/Django-2.2.7-py3-none-any.whl
Collecting pytz
Using cached https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl
Collecting sqlparse
Using cached https://files.pythonhosted.org/packages/ef/53/900f7d2a54557c6a37886585a91336520e5539e3ae2423ff1102daf4f3a7/sqlparse-0.3.0-py2.py3-none-any.whl
Installing collected packages: pytz, sqlparse, django
Successfully installed django-2.2.7 pytz-2019.3 sqlparse-0.3.0
(myvenv) ➜ djangogirls git:(master) ✗ django-admin startproject mysite .
(myvenv) ➜ djangogirls git:(master) ✗ python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying sessions.0001_initial... OK
(myvenv) ➜ djangogirls git:(master) ✗ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
December 01, 2019 - 22:06:38
Django version 2.2.7, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[01/Dec/2019 22:07:20] "GET / HTTP/1.1" 200 16348
[01/Dec/2019 22:07:20] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
Not Found: /favicon.ico
[01/Dec/2019 22:07:20] "GET /favicon.ico HTTP/1.1" 404 1972
[01/Dec/2019 22:07:20] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
[01/Dec/2019 22:07:20] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[01/Dec/2019 22:07:20] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
그랬더니 며칠전에 생겼던 여러 오류들이 한번도 생기지 않고 원활히 설치되는 것을 확인할 수 있다......ㅠㅠ
로컬호스트에서 장고프로젝트 열어보기
우여곡절 끝에 성공 정말 눈물이난다 ㅠ