Based on the django_tutorial repo, extended for PyCon demos
APACHE-2.0 License
The official Django tutorial, extended for PyCharm demo uses.
requirements.txt
npm install
to get JS dependencies.manage.py
console via Tools | Run manage..py task
makemigrations
and press entermigrate
and press entercreatesuperuser
(and answer the questions)python manage.py load_questions
django_tutorial
)http://127.0.0.1:8000/admin/
and add a questionhttp://127.0.0.1:8000/polls/
Other steps:
Mark as Templates Folder
for polls/templates
Settings | Languages & Frameworks | JavaScript | Prettier
and set it up to run on save/reformat<script>
for Tailwind, Alt-Enter on the URL, and "Download" as a libraryFor the extended demo:
BlackConnect
plugin installed
blackd
installed somewhere, e.g. via pipx or add to the venv.env
and requirements
pluginsWe're going to talk about the "I" in "IDE".
Django
template in New Project
tem/bas
to open templates/base.html
Django Server
run configurationView Polls
img
with PyCharm.svg
polls/views.py
number of returned questions[0:10]
to [0:1]
Run manage.py
tool window to makemigrations
makemigrations
polls.views.IndexView.get_queryset
polls.templates/polls/index.html
{% for question in latest_question_list %}
/polls/
Shift-Shift INS
to navigate to INSTALLED_APPS
in mysite/settings.py
Shift-Shift pol/ind
to open polls/index.html
latest_question_list
on line 9polls/index.html
, navigate to latest_question_list
INSTALLED_APPS
polls/index.html
navigate back and forth, view/template, via iconsCmd-Alt-O urlpa
to open polls/urlpatterns.py
views.ResultsView.as_view()
to ReVi
and Cmd-Space-Space
to autocompleteShift-Shift IndV
to navigate to polls.views.IndexView
index.html
to djindex.html
Shift-Shift pol/ind
to open polls/index.html
<img src
with Emmet
img tab
to start the <img>
LiveTemplate{% s
to start the static
Django tagpolls/images/jb_beam.png
pathjb_beam.png
segmentCmd-Shift-A Spl Ri
to split rightCmd-Alt-O IndV
to navigate to IndexViewCmd-Alt-O t_p
to navigate to tests/test_base_functions.test_polls_index
IndexView.get_queryset
TODO We need to file a PR.
run-apis.http
IndexView.get_queryset
on the return
base.html
and <script src="https://cdn.tailwindcss.com">
<div class="navbar
and autocomplete navbar
navbar
to see definitionpackage.json
, run the dev
scriptApp
Index
package.json
and npm integration
Index.jsx
mess up spacing, indentationIndex.jsx
put a breakpoint on {question.question_text}
Index.tes
to navigate to the test filepolls_question
tableThis goes before the full-stack part and covers material from Adam's "Boost Your Django DX" book.
IndexView.get_queryset
mouse over:
import
for Python codefilter
for Django codeh1
to show MDN-integrated docsrequirements.txt
print(2+2)
with syntax highlighting, autocompleteBlackConnect
is off!.editorconfig
4
to 14
conftest.py
14
back to 4
.pre-commit-config.yaml
This will be used in the sponsor talk at PyCon US 2023. It emphasizes points made in Adam Johnson's Django DX book.