install #django

Leo ·

install #django

Replies

Leo ·

python3 manage.py runserver

Leo ·

django-admin startproject mysite

Leo ·

python manage.py startapp appname

Leo ·

in terminal: `python3 -m pip install Django`This will install Django in the virtualenv you have active.Once done, to verify, type `python3` to enter the python shell and type:>>> import django>>> print(django.get_version())(without the >>>, those are automatically there on each line with python)You should see the the version # in the terminal below the commands

Leo ·

Confirm install:`python3 -m django --version`

Leo ·

After having set up a "polls" app in our "djangoTest" project, and created models in our polls app, you have to activate those models in the project by first adding polls to INSTALLED_APPS setting of djangoTest and then running a `python3 manage.py makemigrations polls` command

Leo ·

make migrations file for "polls" app folder model changes that when migrated will add those new models or model changes to database

Leo ·

Shows what SQL code a specific migration file will run

polls = the app folder, 0001 = the specific migration file

Leo ·

Playing around with the api

Leo ·

Full database api documentation

Leo ·

creates a python date entity using datetime.datetime module format. Can be converted to desired format by calling strftime() on the element created with a format string passed in, see https://www.w3schools.com/python/python_datetime.aspfor list of format codes

Leo ·

python manage.py test polls

Leo ·

in desired virtual envpip install psychopg2but ran into some issues. To solve:brew install openssl (if not already installed)and in the virtual envexport LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/https://stackoverflow.com/questions/59065263/is-there-any-problem-installing-psycopg2-in-virtualenv-on-macos-catalina-with-pohttps://github.com/psycopg/psycopg2/issues/997

Leo ·

startup postgres serverpostgres -D /usr/local/var/postgres

Leo ·

www.link.com

Leo ·

https://knovigator.com/quest/django-custom-commands-6m2x4z3g