简体   繁体   中英

shebang python line on ubuntu is not working for my webpage

I am writing index.py for my web page test on my Ubuntu laptop.

I wrote #!usr/bin/env python3 at the top of the code and used some print() lines below it.

when I open the webpage under my IP address... the page is not printing what I intended and shows the whole code directly.

Could you see what I was wrong with?

Thanks! Paul

Browsers don't understand python and they shouldn't run any file on your PC, so they will show the file as if it were HTML. To make a website with python, you can either use a webframework like django or just write the ouput of your python script into a html/text file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM