运行WSGI应用程序时出错,ModuleNotFoundError:没有名为“ mysite”的模块

时间:2018-07-08 20:59:30

标签: python django pythonanywhere

我正在尝试使用pythonanywhere在整个项目中部署Django项目,但遇到了问题并且确实卡住了。谁能帮助我。该图像附加到我的setting.py文件的路径中。 Path to settings.py

Webttab上的WSGI.py配置为:

html

重新加载后显示的错误是:

path = '/home/technewsandblog/blog/blog_project/mysite'
if path not in sys.path:
sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

# then:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

我该怎么办?

谢谢。

1 个答案:

答案 0 :(得分:1)

您的路径必须为public class Driver extends commonhelper{ public static int Drvrownum = 3; @Test public void ExecuteDriver() throws Exception { for (int i = Drvrownum; i < (ExcelWS.getLastRowNum() + Drvrownum); i++) { String mname = GetDatafromCell("Global", Drvrownum, "ActionName"); String EF = GetDatafromCell("Global", Drvrownum, "ExecutionFlag"); if (EF.equalsIgnoreCase("false")) { Drvrownum = Drvrownum + 1; continue; } else { switch (mname) { case "WorkQueue": WorkQueue wq = new WorkQueue(); wq.RunWQcases(); Drvrownum = Drvrownum + 1; break; case "XXX": System.out.println("All Iterations Completed"); Drvrownum = Drvrownum + 1; return; default: break; } } } } } And my test Script: public class WorkQueue extends commonhelper{ public static int WQrownum = 2; public static String EXLFilePath = scrpath + "\\TestData\\Express.xlsx"; @Test public void RunWQcases() throws Exception { setExcelFile(EXLFilePath, "WorkQueue"); for (int i = WQrownum; i < (ExcelWS.getLastRowNum() + WQrownum); i++) { String WQMname = GetDatafromCell(WQrownum, "ActionName"); String AEF = GetDatafromCell(WQrownum, "ExecutionFlag"); if (AEF.equalsIgnoreCase("false")) { WQrownum = WQrownum + 1; continue; } else { switch (WQMname) { case "ExecuteWQ": ExecuteWQ(); WQrownum = WQrownum + 1; break; case "openchart": openchart(); WQrownum = WQrownum + 1; break; case "XXX": System.out.println("Sub Class Iterations Completed"); WQrownum = WQrownum + 1; return; } } } } @Test public void ExecuteWQ() throws Exception { driver.findElement(By.linkText("Work Queue")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Coding WQ"))); driver.findElement(By.linkText("Coding WQ")).click(); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//table[@class='main']"))); } @Test public void openchart() throws Exception { WebElement wqtable = driver.findElement(By.xpath("//table[@class='main']")); List<WebElement> trow = wqtable.findElements(By.tagName("tr")); for (int i = 0; i < trow.size(); i++) { boolean getrow = false; List<WebElement> tcol = trow.get(i).findElements(By.tagName("th")); System.out.println("Number of Columns = " + tcol.size()); for (int j = 0; j < tcol.size(); j++) { if (tcol.get(j).getText().equalsIgnoreCase("Action")) { driver.findElement(By.className("grid-edit")).click(); getrow = true; break; } } if (getrow) { break; } } Thread.sleep(2000); } }

当前,您的/home/technewsandblog/blog/blog_project和设置模块/home/technewsandblog/blog/blog_project/mysite的路径意味着它期望位于mysite.settings上的settings.py文件

也请查看WSGI import errors上的PythonAnywhere帮助页面。 (特别是Django部分)