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
litespeed_wiki:other-ext-apps:django-web-framework-with-gunicornn [2017/08/30 12:07]
Usman Nasir
litespeed_wiki:other-ext-apps:django-web-framework-with-gunicornn [2017/08/30 18:41] (current)
Usman Nasir [Step 6: Static Content!]
Line 3: Line 3:
 On a shared hosting environment with cPanel/WHM installed, we can use Litespeed Enterprise to host Django app on per account basis by proxying content to gunicorn. On a shared hosting environment with cPanel/WHM installed, we can use Litespeed Enterprise to host Django app on per account basis by proxying content to gunicorn.
  
-==== Requirments ==== 
- 
-  * You must have a server with cPanel/WHM installed. 
-  * One live domain. 
-  * Litespeed Enterprise installed on top of WHM. 
  
 ====== Step 1: Create Django Project ====== ====== Step 1: Create Django Project ======
Line 88: Line 83:
 PIDFile=/​run/​gunicorn/​pid PIDFile=/​run/​gunicorn/​pid
 User= someuser User= someuser
-Group=someuser+Group= someuser
 RuntimeDirectory=gunicorn RuntimeDirectory=gunicorn
-WorkingDirectory=/​root/litespeedtech+WorkingDirectory=/​home/litespeed/​public_html/​djangoproject
 ExecStart=/​usr/​bin/​gunicorn --pid /​run/​gunicorn/​pid ​  \ ExecStart=/​usr/​bin/​gunicorn --pid /​run/​gunicorn/​pid ​  \
-          --bind 127.0.0.1:​5003 ​litespeedtech.wsgi+          --bind 127.0.0.1:​5003 ​djangoproject.wsgi
 ExecReload=/​bin/​kill -s HUP $MAINPID ExecReload=/​bin/​kill -s HUP $MAINPID
 ExecStop=/​bin/​kill -s TERM $MAINPID ExecStop=/​bin/​kill -s TERM $MAINPID
Line 102: Line 97:
 This file contains four important elements. This file contains four important elements.
  
-  * WorkingDirectory = ''/​home/​litespeed/​public_html/​djangoproject/​djangoproject''​ (This is the directory where your Django project resides)+  * WorkingDirectory = ''/​home/​litespeed/​public_html/​djangoproject''​ (This is the directory where your Django project resides)
   * Second thing is ''​djangoproject.wsgi'',​ replace ''​djangoproject''​ with your project name.   * Second thing is ''​djangoproject.wsgi'',​ replace ''​djangoproject''​ with your project name.
   * –bind 127.0.0.1:​5003 : Make sure you use the same address port combination that you have used in the socket file.   * –bind 127.0.0.1:​5003 : Make sure you use the same address port combination that you have used in the socket file.
Line 173: Line 168:
 </​code>​ </​code>​
  
-This will create a new folder ''​static''​ under ''/​home/​litespeed/​public_html/​djangoproject'',​ we can either use rewrite rules to move all requests for static content to this location or we can move this folder to the parent folder where Litespeed will actually look for the static ​file ''/​home/​litespeed/​public_html''​+This will create a new folder ''​static''​ under ''/​home/​litespeed/​public_html/​djangoproject'',​ we can either use rewrite rules to move all requests for static content to this location or we can move this folder to the parent folder where Litespeed will actually look for the static ​files at ''/​home/​litespeed/​public_html''​
  
 <​code>​ <​code>​
Line 179: Line 174:
 </​code>​ </​code>​
  
-This will move folder ''​static''​ to its parent folder, and litespeed ​can now easily serve static content. That's all you can now visit your domain and it should start service ​your Django project.+This will move folder ''​static''​ to its parent folder, and LiteSpeed ​can now easily serve static content. That's allyou can now visit your domain and it should start serving ​your Django project.
  • Admin
  • Last modified: 2017/08/30 12:07
  • by Usman Nasir