*** Copy & paste this text within file: myproject.py
Enter in the browser, one's domain at port:5000 (eg. http://[MySeverIP]:5000), the result should 'Hello there!' in green letters. Type in the PuTTY console: 'ctl'+c to exit.
Step02:Test wsgi
Logon the server, via PuTTY, and enter the following commands:
(venv) sammy@imega:~/myapp$ nano myproject.py // change the word 'green' to 'blue
(venv) sammy@imega:~/myapp$ nano wsgi.py //see **
Enter in the browser, one's domain at port:5000 (eg. http://myexample.com:5000), the result should 'Hello there!' in blue letters. Type in the PuTTY console: 'ctl'+c to exit wsgi.
Step03: WSGI serving Myproject.py
Logon the server, via PuTTY, and enter the following commands:
The output should show the service as active. Moreover, a file called 'myproject.sock' should appear in the 'myapp' directory.
Should the service be functioning well, then established it by enabling it permanently into services with the following command:
Warning: There are in the Debian environment, slight differences with regard to that of the Win-PC. Take note of these:
- File names are case-sensitive. Example: myphoto.jpg and myphoto.JPG are seen as different files. If the image is not appearing in your website, check this issue.
- Permissions and Ownerships are concepts deeply implemented in the Linux environment. To ensure correct permissions and ownership for the above-example:
sammy@imega:~/myapp$ cd ~
sammy@imega:~$ chmod -R 775 myapp/ //all files executetable
sammy@imega:~$ chown -R sammy:www-data myapp/ // all files under one ownership.