简体   繁体   中英

how to import python code into views.py file in django

I am new to django and I am trying to link a response from a form submission to a couple python methods I wrote in a different file which will use the user input as parameters. I am wondering how I can import those methods and print their results.

My python file is named Crunch.py and is located in the same directory as views.py I have tried: from Crunch import * but it isn't working. I would like to know if I need to move the file elsewhere or what I need to write to import all the methods from Crunch.

请尝试以下方法

from <app name>.Crunch import *

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