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
python_wiki:django_configuration [2018/08/03 16:38]
billdozor [Django Configuration]
python_wiki:django_configuration [2019/05/25 23:50] (current)
Line 28: Line 28:
   * Run secure setup<code bash>mysql_secure_installation</code>   * Run secure setup<code bash>mysql_secure_installation</code>
     * Prompts for the following:     * Prompts for the following:
 +      * Current password for root (should be none, just press enter)
       * Set database root password       * Set database root password
       * Remove anonymous users       * Remove anonymous users
Line 50: Line 51:
 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 235: Line 236:
   * Create logging directory and setup ownership/permissions<code bash>mkdir /var/log/myprojecthere   * Create logging directory and setup ownership/permissions<code bash>mkdir /var/log/myprojecthere
 chown :apache /var/log/myprojecthere chown :apache /var/log/myprojecthere
-chmod g+rwx /var/log/myprojecthere</code>+chmod g+rwxs /var/log/myprojecthere</code>
  
 ===== Admin Interface ===== ===== Admin Interface =====
Line 241: Line 242:
   * 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 906: Line 907:
  <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 1550: Line 1551:
 <a href="#" class="plain" onclick="$('#assetlist').tableExport({type:'excel',escape:'false'});"><img src="{% static 'myapphere/xls.png' %}" width="24px" title="Export Excel"></a></code> <a href="#" class="plain" onclick="$('#assetlist').tableExport({type:'excel',escape:'false'});"><img src="{% static 'myapphere/xls.png' %}" width="24px" title="Export Excel"></a></code>
  
 +----
 +
 +====== Django: Static Files ======
 +
 +No matter which steps from above you skip, you absolutely need to collect static files to copy them into the location Apache expects them to be.
 +
 +This is for Apache's access to javascript, css, etc.
   * 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>
 +
 +----
 +
 +====== Next Steps =======
 +
 +[[python_wiki:django_api|Proceed to the Django API]] section.
  
 ---- ----
  
  • python_wiki/django_configuration.1533328694.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)