Skip to content

Instantly share code, notes, and snippets.

@moriya9n
Last active October 9, 2019 09:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moriya9n/0137b88391896e939128859aad601bd6 to your computer and use it in GitHub Desktop.
Save moriya9n/0137b88391896e939128859aad601bd6 to your computer and use it in GitHub Desktop.
さくらのレンタルサーバで django / python 3.6 を動かす (速度は期待できないかも)
1. [python 3.6 をインストール](https://gist.github.com/moriya9n/22daf53cae550fa91e365e1acd4d7f8a)する。 venv で仮想環境を作っておく。
2. pip install django
3. django-admin startproject hogehoge
4. レンタルサーバの仕様上、cgi でしか動作しないので、 django-cgi(https://github.com/chibiegg/django-cgi/blob/master/django-python3.cgi)
を取ってくる。(速度は期待できない)
5. cgi の先頭の python パス名は変更。sys.path.append でプロジェクトディレクトリを追加。
6. index.cgi などにリネームして、好きなところに配置。
7. /home/your_account/static などを作って、settings.py に STATIC_ROOT = '/home/your_account/static' を追加。python manage.py collectstatic
を実行。
8. ln -s /home/your_account/static /home/your_account/www/site_name/static
9. index.cgi/admin にアクセス
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment