python_wiki:django_configuration

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
python_wiki:django_configuration [2018/08/03 16:27]
billdozor [Database Setup]
python_wiki:django_configuration [2018/08/04 15:50]
billdozor [Page Content: Index]
Line 3: Line 3:
 **General Information** **General Information**
  
-Configuring the Django Web Framework and its dependencies. +Configuring the Django Web Framework and its dependencies.
  
 +\\
 +The **EXAMPLE** sections of code end up building an inventory website.
 +
 +\\
 **Checklist** **Checklist**
   * [[python_wiki:django_install|Django installed]]   * [[python_wiki:django_install|Django installed]]
Line 46: Line 50:
 Configuring Django. Configuring Django.
  
-  * Verify django works<code bash>python+  * Verify django works<code python>python
 >>> import django >>> import django
 >>> print(django.get_version()) >>> print(django.get_version())
Line 237: Line 241:
   * Create an admin user<code bash>python manage.py createsuperuser</code>   * Create an admin user<code bash>python manage.py createsuperuser</code>
  
-  * Make your models/objects available for editing in the admin portal (/home/django/myprojecthere/myapphere/admin.py)<code bash># -*- coding: utf-8 -*-+  * Make your models/objects available for editing in the admin portal (/home/django/myprojecthere/myapphere/admin.py)<code python># -*- coding: utf-8 -*-
 from __future__ import unicode_literals from __future__ import unicode_literals
  
Line 290: Line 294:
   url(r'^(?P<env_name>(dev|test|prod))/$', views.env, name='env'),   url(r'^(?P<env_name>(dev|test|prod))/$', views.env, name='env'),
  
-  # /myapphere/device/  - Specific Device, All Environments +  # /myapphere/device_type/  - Specific Device, All Environments 
-  url(r'^(?P<device>(servers|workstations|switches|routers|firewalls))/$', views.device, name='device'),+  url(r'^(?P<device_type>(firewalls|routers|servers|storage|switches|workstations))/$', views.asset_type_all_env, name='asset_type_all_env'),
  
-  # /myapphere/device/env_name  -  Specific Device, Specific Environment +  # /myapphere/device_type/env_name  -  Specific Device, Specific Environment 
-  url(r'^(?P<device>(servers|workstations|switches|routers|firewalls))/(?P<env_name>(dev|test|prod))/$', views.device_env, name='device_env'),+  url(r'^(?P<device_type>(firewalls|routers|servers|storage|switches|workstations))/(?P<env_name>(dev|test|prod))/$', views.type_env, name='type_env'), 
 + 
 +  # /myapphere/<asset_hardware> - Physical or Virtual 
 +  url(r'^(?P<asset_hardware>(physical|virtual))/$', views.asset_hardware, name='asset_hardware'),
 ]</code> ]</code>
  
Line 899: Line 906:
  <thead>  <thead>
   <tr class="myapphere">   <tr class="myapphere">
-    <th class="myapphere">Device</th>+    <th class="myapphere">Device Type</th>
     <th class="myapphere">Name</th>     <th class="myapphere">Name</th>
     <th class="myapphere">Description</th>     <th class="myapphere">Description</th>
     <th class="myapphere">Environment</th>     <th class="myapphere">Environment</th>
     <th class="myapphere">OS</th>     <th class="myapphere">OS</th>
-    <th class="myapphere">Type</th>+    <th class="myapphere">Hardware</th>
   </tr>   </tr>
  </thead>  </thead>
Line 1545: Line 1552:
   * Collect static files<code bash>cd /home/django/myprojecthere/   * Collect static files<code bash>cd /home/django/myprojecthere/
 python manage.py collectstatic</code> python manage.py collectstatic</code>
 +
 +----
 +
 +====== DEBUG: TURN OFF ======
 +
 +Lastly, when you are not developing/debugging your site, **turn off debug mode** to avoid dumping sensitive information to the screen in the event of an error.
 +
 +\\
 +Edit the project settings (/home/django/myprojecthere/myprojecthere/settings.py)<code python># SECURITY WARNING: don't run with debug turned on in production!
 +DEBUG = False</code>
  
 ---- ----
  
  • python_wiki/django_configuration.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)