0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Django ローカル環境 Apache 接続設定(windows)

Posted at

・Djangoは venv で作成。

■Apache ./conf/httpd.conf

httpd.conf
############ Python Django 用設定 追加 ############
 
LoadFile C:/Users/natsume/AppData\Local/Programs/Python/Python39/python39.dll
 
LoadModule wsgi_module C:/Users\natsume/AppData/Local/Programs/Python/Python39/Lib\site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd
 
WSGIPythonHome C:/Users\natsume/AppData/Local/Programs/Python/Python39
WSGIScriptAlias / D:/Django/django_project/django_project/wsgi.py
WSGIPythonPath D:/Django/django_project/django_project
 
<Directory D:/Django/django_project/django_project>
  <Files wsgi.py>
    Require all granted
  </Files>
</Directory>
 
Alias /static/ D:/Django/django_project/static
 
<Directory D:/Django/django_project/static>
  Require all granted
</Directory>
 
############ Python Django 用設定 追加 END ############

■django の設定ファイル setting.py

Apacheのポート番号に合わせる

py setting.py

### Apacheの環境に合わせる
# ALLOWED_HOSTS =
# ALLOWED_HOSTS = ['localhost','127.0.0.1','*', '127.0.0.1:8082']
ALLOWED_HOSTS = ['localhost','127.0.0.1:8082','*','localhost:8082']
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?