Issue
I have a Django project on local machine running on Python 3.10.3
Now I deployed it to a DigitalOcean machine running Ubuntu 20 and Python 3.8.10
When I run the project on local machine there is no issue, but when I do run it on the DO instance, it gives me a syntax error.
Here is the code where it gives me the error:
def get_day_by_date(date):
weekday = date.weekday()
match weekday:
case 0:
return "Lundi"
case 1:
return "Mardi"
case 2:
return "Mercredi"
case 3:
return "Jeudi"
.......
This is the error I get in DO:
Is it a problem of the Python version?
PS: I have already done pip freeze and installed the exact same requirements on both machines.
Solution
The solution according to @BoarGules is to migrate from Python 3.8 to 3.10 for the match weekday
to work.
Answered By – Kaiss B.
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0