1

そこで、apache と mod wsgi を使用して vps に django をデプロイしました。1つのことを除いて、すべてが正常に機能しているようです。フォームを送信しようとすると、500 サーバー エラーが発生します。apache のエラー ログにエラーは表示されませんが、これは非常に奇妙です。

また、フォーム送信の前に、mod wsgi が 1 つのバージョンの Python を実行しており、他のバージョンが mod wsgi を実行しているというエラーが発生していました。mod wsgi を ./configure することでこれを修正しました。

他に何か必要な場合はお知らせください。

これが私のApache confです:

<VirtualHost *:80>
        ServerAdmin marijus.merkevicius@gmail.com
        ServerName 5.199.166.109
        WSGIDaemonProcess ts threads=25
        WSGIProcessGroup ts
        Alias /static /home/tshirtnation/staticfiles
        WSGIScriptAlias / /home/tshirtnation/index.wsgi
</VirtualHost>

mod wsgi:

import os import sys import サイト

# Add the app's directory to the PYTHONPATH
sys.path.append('/home/tshirtnation')
sys.path.append('/home/tshirtnation/tshirtnation')

os.environ['DJANGO_SETTINGS_MODULE'] = 'tshirtnation.settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

さて、開発中に別のデータベースを使用していて、正常に動作しているため、データベースが原因であることがわかりました。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'tshirtnation',
        'USER': 'root',
        'PASSWORD': 'xxx',
        'HOST': '5.199.166.109',   # Or an IP Address that your DB is hosted on
        'PORT': '3306',
    }
}

ここに私の設定があります。私は何か間違っていますか?

編集:

本番データベースで開発を試みたところ、すべてが機能しました:/このエラーの原因がまったくわかりません..

4

0 に答える 0