ローカルサーバで動かしていたpythonのシステムをレンタルサーバ上で動かしたい。
index.cgiの中にconfig.cgiモジュールを読み出して、htmlに組み込んでいるのですが、ローカルではうまくいくのですが、Webサーバにアップすると動かなくなりました。
パーミッションは755にしました。
パスの問題なのかなぁ、とは思いつつも、どのように直せばよいか分からず、質問させていただきました。どうぞよろしくお願いします。
ファイル構成
cgi-bin
|--index.cgi
|--config.cgi
###コード内容
python
1--index.cgi-- 2#!/usr/local/bin/python 3# -*- coding: utf-8 -*- 4 5import config as conf 6 7print ("Content-Type: text/html\n") 8print ("") 9print (""" 10<!DOCTYPE html> 11<html lan="ja"> 12<head> 13 {1} 14 <title>{0}</title> 15 {2} 16 <link rel="stylesheet" type="text/css" href="../css/style.css"> 17 <link rel="shortcut icon" href="../img/favicon.ico" /> 18 19</head>""").format(conf.MAIN_TITLE, conf.METATAG, conf.FONTAWESOME)
Python
1--config.cgi-- 2#!/usr/local/bin/python 3# -*- coding: utf-8 -*- 4 5"""全ファイル共通""" 6 7MAIN_TITLE = 'タイトルでーす' #メインタイトル 8 9METATAG = '<meta charset="utf-8">\n\t<meta http-equiv="Content-Script-Type" content="text/javascript">' 10 11FONTAWESOME = '<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">\n\t<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome-animation/0.0.10/font-awesome-animation.css" type="text/css" media="all" />' #fontawesomeとanimationへのリンク 12
###エラーログ
File "index.cgi", line 4, in <module>: /~/www/python_mate/cgi-bin/index.cgi import config as conf: /~/www/python_mate/cgi-bin/index.cgi ImportError: No module named config: /~/www/python_mate/cgi-bin/index.cgi
回答1件
あなたの回答
tips
プレビュー