Deployment Django on Simple appplication server
Created#More Posted time:Nov 15, 2019 11:02 AM
I'm very new in using django on SAS, I been having problem finding solution or guide for my predictment, I was able to set Django following the community guide https://www.alibabacloud.com/blog/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04_594319?spm=a2c5t.11065253.1996646101.searchclickresult.2bcb5ec8VXDHtq
but when deploy, the server display timeout. can some one point out any other resources or guide?
1st Reply#Posted time:Nov 17, 2019 5:13 AM
What sort of time do you see? If this is a network time out, then I guess the problem is with the network, make sure you can access the endpoints.
One more thing, please try to access the hosted resource from within the VM itself, sometimes the service is down inside the VM too. Please try these and let me know what you get.
2nd Reply#Posted time:Nov 17, 2019 12:46 PM
I getting 502 Gateway error, If I type my public ip address following by port number (8000) the issue is connection time out. I need a way to debug what causing the issue. as for access hosted resources does it mean access through FTP or VNC?
I appreciate your time
3rd Reply#Posted time:Nov 22, 2019 17:50 PM
Well, I understand there can be several problems for this gateway issue as well as the timeout (which might just mean that the port 8000 is not listening for any traffic).
What I meant to ask was, login to the SAS server (using RDP, SSH or Rescue Connect), and then access the app within the VM for SAS service. You mentioned that you followed an article that needs to execute some commands to install and configure services; that is why I am assuming that you have access to the terminal.
One of the tools that can be used to send a request and load a page on the VM is "lynx", it is a terminal-based web browser. Try downloading this, and access the service using the localhost and the port number to see if that works.
Here is one of my articles that would help you in understanding how to host and debug the services on SAS; https://dev.to/afzaalahmadzeeshan/how-to-host-a-node-js-web-app-on-ubuntu-18-04-using-alibaba-cloud-simple-application-server-43hm.
4Floor#Posted time:Mar 10, 2021 22:03 PM
Thank you for sharing. I found it very helpful. Appreciated.
Please conform to the indentation style dictated in the .editorconfig file. We recommend using a text editor with EditorConfig support to avoid indentation and whitespace issues. The Python files use 4 spaces for indentation and the HTML files use 2 spaces.
Unless otherwise specified, follow PEP 8.
Use flake8 to check for problems in this area. Note that our setup.cfg file contains some excluded files (deprecated modules we don’t care about cleaning up and some third-party code that Django vendors) as well as some excluded errors that we don’t consider as gross violations. Remember that PEP 8 is only a guide, so respect the style of the surrounding code as a primary goal.
An exception to PEP 8 is our rules on line lengths. Don’t limit lines of code to 79 characters if it means the code looks significantly uglier or is harder to read. We allow up to 119 characters as this is the width of GitHub code review; anything longer requires horizontal scrolling which makes review more difficult. This check is included when you run flake8. Documentation, comments, and docstrings should be wrapped at 79 characters, even though PEP 8 suggests 72.
Use four spaces for indentation.