python 3.x - Django Server autorun when Ubuntu startup or reboot? -


i want logic server(python3+django+uwsgi+nginx) autorun when ubuntu-server startup or reboot. so, write execute script (uwsgi --ini=/data/xxx.ini), , add /etc/rc.local .

then, restart server, logic-server running, but when program print log file , python3 throw exception:

traceback (most recent call last):   file "/usr/lib/python3.4/logging/handlers.py", line 73, in emit     logging.filehandler.emit(self, record)   file "/usr/lib/python3.4/logging/__init__.py", line 1041, in emit     streamhandler.emit(self, record)   file "/usr/lib/python3.4/logging/__init__.py", line 984, in emit     self.handleerror(record)   file "/usr/lib/python3.4/logging/__init__.py", line 915, in handleerror     traceback.print_stack(frame, file=sys.stderr)   file "/usr/lib/python3.4/traceback.py", line 286, in print_stack     print_list(extract_stack(_get_stack(f), limit=limit), file=file)   file "/usr/lib/python3.4/traceback.py", line 30, in print_list     print(item, file=file, end="") unicodeencodeerror: 'ascii' codec can't encode characters in position 95-100: ordinal not in range(128) call stack:   file "/usr/local/lib/python3.4/dist-packages/django/core/handlers/wsgi.py", line 177, in __call__     response = self.get_response(request)   file "/usr/local/lib/python3.4/dist-packages/django/core/handlers/base.py", line 147, in get_response     response = wrapped_callback(request, *callback_args, **callback_kwargs)   file "./carwashing/views/decorators.py", line 65, in _require_login_release     json_resp = views(request, user=token_cache.employee, *args, **kwargs) 

when direct start uwsgi in manual, works well.

you have write .sh file virtual activate code

#!/bin/bash clear cd /path/to your/virtual environment  #path virtual environment . bin/activate  #activate virtual environment cd /path/to your/project directory python manage.py runserver  #run django server 

then write reboot cron job .sh file, work you.

check link more details..


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -