Setup Django 2.2 on FreeBSD 12

2019-07-03 18:15:58+00

Setup Directory and Environment for Django 2.2

# cd /usr/local/www/
mkdir lf-django
cd lf-django

virtualenv dj22 -p python3.6
source dj22/bin/activate.csh
django-admin startproject lf19

pip install django
pip install psycopg2


lf19/settings

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'databasename',
        'USER': 'databaseuser',
        'PASSWORD': 'dont-tell-anybody',
        'HOST': 'localhost',
        'PORT': 5432,
    }
}

ALLOWED_HOSTS = ['104.207.130.68']


python3.6 manage.py runserver 104.207.130.68:8000

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

July 03, 2019 - 18:07:05
Django version 2.2.3, using settings 'lf19.settings'
Starting development server at http://104.207.130.68:8000/
Quit the server with CONTROL-C.
[03/Jul/2019 18:07:12] "GET / HTTP/1.1" 200 16348
[03/Jul/2019 18:07:12] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
[03/Jul/2019 18:07:12] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
[03/Jul/2019 18:07:12] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184
[03/Jul/2019 18:07:12] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692


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

Tag: django