Knowing that there is Django, there was a tutorial site first, so I tried it. Since I am new to Python, there were many places where I failed, so I made a note to look back. There should be no problem for people who are used to it. Or rather, if you matched the versions of Python and Django on your Mac as per the tutorial, there should have been no problem.
https://djangobrothers.com/ The guy who makes the blog management site of
cd /d C:\XXX\
python3 -m venv virtual environment name
I didn't even get an error. In Python3, you can use python, so solve it with the following command.
cd /d C:\XXX\
python -m venv virtual environment name
For Windows
.\Virtual environment name\Scripts\activate
(Virtual environment) >pip install --upgrade pip
...
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5]Access denied.: 'xxx\\scripts\\pip.exe'
Consider using the `--user` option or check the permissions.
Adding --user as instructed does not succeed. Probably because it has been uninstalled.
(Virtual environment) >pip install --upgrade pip --user
Traceback (most recent call last):
File "xxx\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "xxx\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "xxx\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
You can install pip, but it's easier to initialize the virtual environment
cd /d Directory above the virtual environment#Move to a directory above the virtual environment
python -m venv --clear virtual environment name#Initialization
.\Virtual environment name\Scripts\activate #Enter the virtual environment
(Virtual environment) >pip install --upgrade pip --user
On Windows, the dir command instead of ls
On Windows
copy nul index.html
http://127.0.0.1:8000/adminページでエラーが出た A server error occurred. Please contact the administrator.
Looking at the command prompt screen
raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'Asia/Tkyo'
I forgot to write o in settings.py
#TIME_ZONE = 'Asia/Tkyo'
TIME_ZONE = 'Asia/Tokyo'
django.db.utils.OperationalError: no such table: main.auth_user__old
Reference page https://kenjimorita.jp/operationalerror-at-adminpostspostadd-no-such-table-main-auth_user__old/ https://stackoverflow.com/questions/53637182/django-no-such-table-main-auth-user-old
I think it's because SQLite was new because my environment didn't follow the tutorial Django Version:2.0.2 Sqlite3:3.28.0
Resolved by recreating SQLite db with django 2.1.5
pip install django==2.1.5
del db.sqlite3
python manage.py migrate
python manage.py runserver
python manage.py createsuperuser
Recommended Posts