Root of the Django project is where manage.py resides
$ mkdir basic_django
$ cd basic_django
$ virtualenv
assume user already !pip install --user virtualenv$ virtualenv -p python3 .
$ source bin/activate
$ pip install django
version: '3' | |
services: | |
portainer: | |
container_name: portainer | |
image: portainer/portainer-ce | |
command: -H unix:///var/run/docker.sock | |
restart: always | |
ports: | |
- 8000:8000 |
Root of the Django project is where manage.py resides
$ mkdir basic_django
$ cd basic_django
$ virtualenv
assume user already !pip install --user virtualenv$ virtualenv -p python3 .
$ source bin/activate
$ pip install django
from flask import Flask | |
from flask_restful import Api, Resource | |
app = Flask(__name__) | |
api = Api(app) | |
names = { | |
"kukkik": { | |
"age": 30, | |
"gender": "male" |
### !pip install pathos | |
import multiprocessing | |
import concurrent.futures | |
from pathos.multiprocessing import ProcessingPool | |
workers = int(multiprocessing.cpu_count()) | |
@errors_pusher | |
def parallel_threading(main_func, | |
lst_args: list, |
#### cat /etc/systemd/system/ngrok_8888_self_restart.service | |
[Unit] | |
Description= bachkukkik_xavier start ngork on system boot | |
[Service] | |
Type=simple | |
PIDFile=/run/ngrok_jupyter.pid | |
ExecStart=/home/<your username>/ngrok http http://localhost:8888 | |
User=<your username> | |
Group=<your group> |
## if not yet done | |
## $ jupyter notebook --generate-config | |
## $ jupyter notebook password | |
## $ python | |
## [1] from notebook.auth import passwd | |
## [2] passwd() # fill in correct password | |
## [3] exit() | |
## $ sudo nano ~/.jupyter/jupyter_notebook_config.py | |
c.NotebookApp.allow_remote_access = True |
#### cat /etc/systemd/system/jupyter_self_restart.service | |
[Unit] | |
Description= pi_kk start Jupyter Notebook on system boot | |
[Service] | |
Type=simple | |
PIDFile=/run/jupyter.pid | |
ExecStart=/home/pi/.local/bin/jupyter-notebook --config=/home/pi/.jupyter/jupyter_notebook_config.py | |
User=pi | |
Group=pi |
import os | |
from functools import wraps, partial | |
from inspect import signature | |
# https://stackoverflow.com/questions/55748500/simulate-the-assignment-of-function-arguments-to-args-and-kwargs | |
try: | |
module = os.path.basename(__file__) | |
except: | |
module = 'some_plain_str' |
import concurrent.futures | |
import time | |
start = time.perf_counter() | |
def do_something(seconds): | |
print(f'Sleeping {seconds} second(s)...') | |
time.sleep(seconds) | |
return 'Done Sleeping...' |