python:dev-mode
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
python:dev-mode [2024/10/02 07:13] – kirtisingh | python:dev-mode [2024/10/02 07:52] (current) – kirtisingh | ||
---|---|---|---|
Line 109: | Line 109: | ||
When you change into //mysite// folder, it contains // | When you change into //mysite// folder, it contains // | ||
+ | W.r.t. Django, please refer to these important links \\ | ||
+ | * https:// | ||
+ | * https:// | ||
+ | Now to fire our Django app, we use gunicorn | ||
- | You you can upload/ | + | < |
+ | gunicorn -b 0.0.0.0:8000 -w 4 --forwarded-allow-ips=' | ||
+ | </code> | ||
- | Below code is saved to hello.py | + | To run it in background, we append & to the above command |
< | < | ||
- | from flask import Flask | + | gunicorn -b 0.0.0.0: |
+ | </ | ||
- | app = Flask(__name__) | ||
- | @app.route(" | + | To exit virtual environment use the command |
- | def hello_world(): | + | < |
- | | + | deactivate |
+ | </ | ||
+ | |||
+ | |||
+ | **Generic Python App** | ||
+ | |||
+ | < | ||
+ | mkdir generic-project | ||
+ | cd geneic-project | ||
+ | python3 -m venv .venv | ||
+ | source .venv/bin/ | ||
+ | </ | ||
+ | |||
+ | Running the last command with activate the virtual environment, | ||
+ | |||
+ | < | ||
+ | pip install gunicorn | ||
+ | </ | ||
+ | |||
+ | Here is a small hello world example of our generic app | ||
+ | |||
+ | Below code is saved to hello.py | ||
+ | |||
+ | < | ||
+ | def app(environ, start_response): | ||
+ | | ||
+ | start_response(" | ||
+ | (" | ||
+ | (" | ||
+ | ]) | ||
+ | return iter([data]) | ||
</ | </ | ||
Line 133: | Line 169: | ||
To run it in background, we append & to the above command | To run it in background, we append & to the above command | ||
- | To exit virtual environment use the command | ||
< | < | ||
- | deactivate | + | gunicorn -b 0.0.0.0: |
</ | </ | ||
+ | To exit virtual environment use the command | ||
< | < | ||
- | gunicorn -b 0.0.0.0: | + | deactivate |
</ | </ | ||
+ | \\ | ||
+ | **With this our SSH Console aspect of our python project is covered. Now we will link our app to our VHost/ | ||
+ | |||
+ | |||
+ | **Step 6 :** Log into N99panel and click on ' | ||
+ | |||
+ | {{: | ||
+ | **Step 7 :** Now click on ' | ||
+ | {{: | ||
+ | **Step 8 :** Now further click on 'Map a Python Dev Port' | ||
+ | {{: | ||
+ | **Step 9 :** Fill the form with the requisite details | ||
+ | {{: | ||
+ | With these above mentioned steps, you can showcase your python apps to the world very easily. | ||
python/dev-mode.1727853238.txt.gz · Last modified: 2024/10/02 07:13 by kirtisingh