I uploaded Quokka Python / Flask CMS to a CentOS7 server. Everything works great with the team
sudo python3 manage.py runserver --host 0.0.0.0 --port 80
Then I create the file /etc/init.d/quokkacms. The file contains the following code
start() { echo -n "Starting quokkacms: " python3 /var/www/quokka/manage.py runserver --host 0.0.0.0 --port 80 touch /var/lock/subsys/quokkacms return 0 } stop() { echo -n "Shutting down quokkacms: " rm -f /var/lock/subsys/quokkacms return 0 } case "$1" in start) start ;; stop) stop ;; status) ;; restart) stop start ;; *) echo "Usage: quokkacms {start|stop|status|restart}" exit 1 ;; esac exit $?
But I get an error when starting sudo service quokkacms start
RuntimeError: Click cancels further execution because Python 3 has been configured to use ASCII as the encoding for the environment. Any switch to Python 2 or refer to http://click.pocoo.org/python3/ for
mitigation steps.
It seems to me that this is a bash script. Why do I have different results? I also followed the instructions in the link in the error message, but still no luck.
[update] I already tried the solution provided by the click before I posted this question. Check the results below (I ran root):
[ root@webserver quokka]# python3 Python 3.4.3 (default, Jan 26 2016, 02:25:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> import codecs >>> print(locale.getpreferredencoding()) UTF-8 >>> print(codecs.lookup(locale.getpreferredencoding()).name) utf-8 >>> locale.getdefaultlocale() ('en_US', 'UTF-8') >>> locale.CODESET 14 >>>
source share