ååã®ç¶ãã§ãã
 ä½ã£ãã¢ããªãherokuã«ä¸ãã¾ã
ãªããåèã«ããã®ã¯ãã¡ã
Getting Started with Django on Heroku | Heroku Dev Center
heroku toolbeltã®ã¤ã³ã¹ãã¼ã«
åã試ãã¦ããç°å¢ã¯ubuntuãªã®ã§ubuntuã§ã®ããããã§ãããmacã§ãå¤ãããªãã¨æãã¾ãã
$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
 ã§ãheroku使ãããã®ãã¼ã«ãã¤ã³ã¹ãã¼ã«ããã¾ããgemããå ¥ããã®ãä¸è¬çã£ã½ããã ãã©ããã¾ãåããªãã£ãã®ã§ãã¡ãã§ããã¸rubyå«ãã»ã»ã»
ç°å¢ã®åãåºã
Djangoã®manage.pyããããã£ã¬ã¯ããªã«ç§»åãã
$ pip freeze > requirements.txt
ã§ãå¿ è¦ãªAPIãåãåºãããherokuãç¥ããã¨ãã§ãã¾ãã
Gitã®commit
ãµã¼ãã¼ã«å¯¾ãã¦ã§ã¯ãªãããã¼ã«ã«ã«å¯¾ãã¦commitãã¾ãã
$ git init $ git add . ãããã§ã.gitignoreã«*.pycãç»é²ã $ git commit -m "first commit"
 ã§OK
Herokuã«ç»é²
Herokuã®ã¢ã«ã¦ã³ãã¯ãã§ã«ä½æãã¦ããåæã§ããheroku createã³ãã³ããå®è¡ããã¨ãã¦ã¼ã¶ã¼åã¨ãã¦ã®ã¡ã¼ã«ã¢ãã¬ã¹ããã¹ã¯ã¼ããèããã¾ããæ£ããå ¥åããã¨ãgitã®å 容ãherokuã«ç»é²ããã¾ãã
$ heroku create Enter your Heroku credentials. Email: [email protected] Password (typing will be hidden): Creating fast-savannah-1531... done, stack is cedar http://fast-savannah-1531.herokuapp.com/ | [email protected]:fast-savannah-1531.git Git remote heroku added
 Herokuã«commit
commitããåã«ãherokuã«sshéµãç»é²ããå¿ è¦ãããã¾ãããåã¯ãã¡ããåèã«ãã¦ãã¾ãããã¾ããã
ç¡äºsshéµãç»é²ããã
$ git push heroku master
ã§ãã½ã¼ã¹éãherokuã«é£ãã§ããã¾ãã
ãããªæãã«ãªãã¾ããï¼
http://studysuggest.herokuapp.com
ãã©ãã«ã·ã¥ã¼ãã£ã³ã°
åãã¯ã¾ã£ãç½ éã§ã
Pythonã®ãã¼ã¸ã§ã³æå®
runtime.txtã¨ãããã¡ã¤ã«ãç¨æãã¦ããã¦ã
python-3.3.2
 ã¨ä¸ã«è¨è¼ãã¦ãããå¿ è¦ãããã¾ããã
STATIC_ROOTã®æå®
Django and Static Assets | Heroku Dev Center
ã«å¾ã£ã¦ãsettings.pyã¨wsgi.pyãä¿®æ£ããå¿ è¦ãããã¾ããã
ã¾ãã追å ããã ãã ã¨
FileNotFoundError: [Errno 2] No such file or directory: '/app/suggestStudy/static'
ã¨æãããã®ã§ã
echo dummy > suggestStudy/static/dummy
ã¨ãã¦ãã£ã¬ã¯ããªï¼ãã¡ã¤ã«ãä½æãã¾ããã
Procfileã®ä½æ
herokuãã©ããã£ã¦ããªã±ã¼ã·ã§ã³ãèµ·åããããProcfileã¨ãã¦ä½æãã¦ãããå¿ è¦ãããã¾ãããå 容ã¯ãããªæãã§
web: python manage.py runserver 0.0.0.0:$PORT --noreload
 ã¾ã¨ã
ä½ããå¦ã¶ã«ããããä¸çªå¤§äºãªã®ã¯å®éã«æãåãããã¨ãã·ã¹ãã ã§è¨ãã°ä½ã£ã¦ãå ¬éãããã¨ã ã¨æã£ã¦ã¾ãã
ä¸æ°å¥½ã§ãåããã®ãä½ããå ¬éãããã£ã¼ãããã¯ããããããããã¯ãã£ã¼ãããã¯ãç¡ããã¨ã«å¯¾ãã対çãèããããç®æ¨ã«å¯¾ããå®æ度ãä¸ãã¦ããã
ãããªæãç¡æã§æ°è»½ã«ä½¿ããherokuã¨ããã®ã¯å¼·ãå³æ¹ã«ãªãããããªãããªã¨æãã¾ããã