[PYTHON] DjangoGirls memorandum

Overview

I should say that it is just a memorandum for myself. I wrote it to save you the trouble of learning Django Girls and the trouble of looking back at the previous page (for Windows).

DjangoGirls Go to the Django Girls tutorial. The code etc. that I will write from now on is quoted from the code posted on Django Girls.

Building a virtual environment

python -m venv myvenv   #Creating a virtual environment
myvenv\Scripts\activate #Start virtual environment

Start the Django server

Command execution in virtual environment (myvenv)

python manage.py runserver

Create a new application

Command execution in virtual environment (myvenv)

python manage.py startapp blog

Create a table for the model in the database

Command execution in virtual environment (myvenv)

python manage.py makemigrations blog #Tell Django about model changes
python manage.py migrate blog        #Save edited file

Django admin Creating a superuser

python manage.py createsuperuser

Initialize Git repository

I didn't know if I would type in the user name and email address as it is, so I entered the user name and email address that I usually use.

git init
git config --global user.name "your Name"
git config --global user.email [email protected]

pythonanywhere

How to browse websites published on python anywhere

From the dashboard screen, click Web (the part circled in red). pythonanywhereWeb_2.png

There's a link at Configration for ~ (circled in red in the image below) and you'll see the Django success screen. After that, if you add / admin to the URL, you will be taken to the Django administration screen. You may also want to read the Django Deployment Checklist (https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/) for future reference.

pythonanywhereWeb_3.pngdjango_success.png

Problems and their solutions

--When you use VSCode as an editor and write code as you go through Django, you may get a code error even though it's correct, but it's better to ignore it and not waste time. I think it's better to read the error message for the future, so read it. --If an error different from the tutorial is displayed, check that the import is done correctly and that the code you wrote is correct (such as incorrect word input). At worst, copying the tutorial code will solve it.

Recommended Posts

DjangoGirls memorandum
linux memorandum
jinja2 memorandum
Python memorandum
Django memorandum
Command memorandum
Python Memorandum 2
plotly memorandum
Slackbot memorandum (1)
multiprocessing memorandum
Memorandum MetaTrader 5
[Linux/LPIC] Memorandum
ShellScript memorandum
pip memorandum
Python memorandum
pydoc memorandum
Pandas memorandum
python memorandum
Command memorandum
Python memorandum
pandas memorandum
python memorandum
Python memorandum
Python basics memorandum
Python pathlib memorandum
Knapsack problem memorandum
Memorandum of sed
Python memorandum (algorithm)
Linux memorandum [links]
nc command memorandum
Deep Learning Memorandum
numpy memorandum 1 / np.pad
Revit API memorandum
Memorandum conda command
Pandas operation memorandum
setuptools command memorandum
Python memorandum [links]
tslearn trial memorandum
Django's basic memorandum
Memorandum about validation