-
Open terminal in project root:
-
Sample location:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> Get-Location Path ---- C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
-
Create
pipenv
virtual environment using providedPipfile
configuration:
pipenv install
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> pipenv install Creating a virtualenv for this project... Pipfile: C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name\Pipfile Using C:/Users/FlynntKnapp/AppData/Local/Programs/Python/Python310/python.exe (3.10.6) to create virtualenv... [ ===] Creating virtual environment...created virtual environment CPython3.10.6.final.0-64 in 3523ms creator CPython3Windows(dest=C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\FlynntKnapp\AppData\Local\pypa\virtualenv) added seed packages: pip==22.2.2, setuptools==63.2.0, wheel==0.37.1 activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator Successfully created virtual environment! Virtualenv location: C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM Installing dependencies from Pipfile.lock (16fbc4)... ================================ 9/9 - 00:00:11 To activate this project's virtualenv, run pipenv shell. Alternatively, run a command inside the virtualenv with pipenv run. PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
-
Note line with
Virtualenv location:
. This line will have the virtual environment location. This information may be useful later.-
Sample location:
C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM
-
-
Activate virtual environment:
pipenv shell
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> pipenv shell Launching subshell in virtual environment... PowerShell 7.2.4 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type 'help' to get help.
-
-
Verify current Python interpreter is the one in the virtual environment:
Get-Command python | fl *
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> Get-Command python | fl * HelpUri : FileVersionInfo : File: C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM\Scripts\python.exe InternalName: Python Launcher OriginalFilename: py.exe FileVersion: 3.10.6 FileDescription: Python Product: Python ProductVersion: 3.10.6 Debug: False Patched: False PreRelease: False PrivateBuild: False SpecialBuild: False Language: Language Neutral Path : C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM\Scripts\python.exe Extension : .exe Definition : C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM\Scripts\python.exe Source : C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM\Scripts\python.exe Version : 3.10.6150.1013 Visibility : Public OutputType : {System.String} Name : python.exe CommandType : Application ModuleName : Module : RemotingCapability : PowerShell Parameters : ParameterSets : PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
-
Note that
Path
is (should be) for the Python interpreter which is in the above virtual environment. The Python interpreter is in theScripts
directory of the virtual environment we created above.-
Sample line from above output:
Path : C:\Users\FlynntKnapp\.virtualenvs\totally-new-heroku-app-name-D8cdteJM\Scripts\python.exe
-
-
Perform
accounts
application migration. It is important to do theaccounts
app migration before the rest of the app migrations since we are using aCustomUser
model which inherits fromAbstractUser
:
python manage.py migrate accounts
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> python manage.py migrate accounts Operations to perform: Apply all migrations: accounts Running migrations: Applying contenttypes.0001_initial... OK Applying contenttypes.0002_remove_content_type_name... OK Applying auth.0001_initial... 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 auth.0012_alter_user_first_name_max_length... OK Applying accounts.0001_initial... OK PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
-
Perform project migration:
python manage.py migrate
-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> python manage.py migrate Operations to perform: Apply all migrations: admin, auth, contenttypes, sessions, accounts Running migrations: Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Applying sessions.0001_initial... OK PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
-
Create superuser:
python manage.py createsuperuser
- Follow
createsuperuser
dialog.-
Sample output:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> python manage.py createsuperuser Username: admin Email address: [email protected] Password: Password (again): This password is too common. Bypass password validation and create user anyway? [y/N]: y Superuser created successfully. PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name>
-
- Follow
-
Test application on local server:
python manage.py runserver
-
Sample terminal output on server start:
PS C:\Users\FlynntKnapp\Programming\totally-new-heroku-app-name> python manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). August 19, 2022 - 10:03:05 Django version 4.0, using settings 'config.settings.development' Starting development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.
-
-
Open browser to server address:
-
Login using superuser credentials created above.
-
Investigate Django Admin interface:
-
Investigate the Django Admin Documentation features:
-
Proceed to Create Heroku Application Server Instance.