The story of how the Python bottle worked on Sakura Internet

Just remember, about last year, I think I talked about how Python worked on Sakura's rental server with CGI, but bottle didn't work at all. In conclusion, it worked.

How you found the problem

Upload the complete bottle project to the Sakura rental server. Change the controller part to .cgi and leave the permissions as 755. Bottle.py is placed as it is.

If you access it as it is

Status: 500 Internal Server Error Content-Type: text/plain Content-Length: 59 A server error occurred. Please contact the administrator.

It is said that. This is the cause of the most stumbling. If you follow the log,

-File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 86, in run -File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response -File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 217, in write

It is clearly moving like that. Where is the problem of the error ... I found it when I was looking for it.

ā€¯UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 358: ordinal not in range(128)ā€¯

What a Unicode error. Unicode error where it didn't appear in either the local environment or the Heroku environment.

Where was the problem

When I tried to erase the Japanese in index.tpl, it turned out to work safely. What is this punch line ...

A common routing problem can be easily solved with .htaccess, but this unicode error is hard to beat. I feel like there is another good solution for this, so I'll give it a try.

The Japanese read by {{default_tag}} is also an error. I'm frustrated.

Recommended Posts

The story of how the Python bottle worked on Sakura Internet
Sakura Use Python on the Internet
The story of Python and the story of NaN
How to update the python version of Cloud Shell on GCP
The story of making Python an exe
The story of manipulating python global variables
Use Python external module on Sakura Internet
The story of blackjack A processing (python)
[Python] Read the source code of Bottle Part 2
The story of low learning costs for Python
Why the Python implementation of ISUCON 5 used Bottle
[Python] Read the source code of Bottle Part 1
Image processing? The story of starting Python for
The story of reading HSPICE data in Python
At the time of python update on ubuntu
How the reference of the python array changes depending on the presence or absence of subscripts
In Python, change the behavior of the method depending on how it is called
the zen of Python
The story of sys.path.append ()
Think about how to program Python on the iPad
The story of Python without increment and decrement operators.
The story of FileNotFound in Python open () mode ='w'
[Python] Summary of how to specify the color of the figure
How to enjoy Python on Android !! Programming on the go !!
The story of automatic language conversion of TypeScript / JavaScript / Python
How much do you know the basics of Python?
[Note] The story of setting up the SDK for Python of Azure IoT Hub on Linux
Notes on the version of CUDA, cuDNN where tensorflow-gpu worked
Put the latest version of Python on linux (Debian) on Chromebook
The story of building Zabbix 4.4
Towards the retirement of Python2
The story of implementing the popular Facebook Messenger Bot with python
python3: How to use bottle (2)
[Apache] The story of prefork
[Hyperledger Iroha] Notes on how to use the Python SDK
The story of introducing jedi (python auto-completion package) to emacs
About the ease of Python
How to deploy the easiest python textbook pybot on Heroku
Handling of python on mac
[Python] Calculate the angle consisting of three points on the coordinates
The story of rubyist struggling with python :: Dict data with pycall
How to know the number of GPUs from python ~ Notes on using multiprocessing with pytorch ~
[Python] Tensorflow 2.0 did not support Python 3.8, so the story of downgrading Python
About the features of Python
python3: How to use bottle (3)
python3: How to use bottle
The Power of Pandas: Python
The story of releasing a Python text check tool on GitHub x CircleCI for the first time
How to set cron for regular Python scraping on Sakura server.
How is the progress? Let's get on with the boom ?? in Python
The story that the version of python 3.7.7 was not adapted to Heroku
How to determine the existence of a selenium element in Python
How to change the log level of Azure SDK for Python
How to know the internal structure of an object in Python
March 14th is Pi Day. The story of calculating pi with python
[Python] I wrote the route of the typhoon on the map using folium
Let's measure the test coverage of pushed python code on GitHub.
A story that struggled to handle the Python package of PocketSphinx
How to check the memory size of a variable in Python
[Python] How to get the first and last days of the month
The story of making a standard driver for db with python.