{"id":1444,"date":"2016-04-21T15:09:06","date_gmt":"2016-04-21T22:09:06","guid":{"rendered":"http:\/\/www.laurenwood.org\/anyway\/?p=1444"},"modified":"2016-04-21T15:09:06","modified_gmt":"2016-04-21T22:09:06","slug":"setting-up-on-pythonanywhere","status":"publish","type":"post","link":"https:\/\/www.laurenwood.org\/anyway\/2016\/04\/setting-up-on-pythonanywhere\/","title":{"rendered":"Setting up on PythonAnywhere"},"content":{"rendered":"<p>A check\u00adlist for mov\u00ading a Django-Wag\u00adtail pro\u00adject to Python\u00adAny\u00adwhere. There is <a href=\"https:\/\/help.pythonanywhere.com\/pages\/DeployExistingDjangoProject\/\">doc\u00adu\u00adment\u00ada\u00adtion on the Python\u00adAny\u00adwhere site<\/a>; mine includes things I forget.<\/p>\n<p>Setup: devel\u00adop\u00adment and test\u00ading on my laptop, sta\u00adging and pro\u00adduc\u00adtion on PythonAnywhere.<\/p>\n<p>The help files are pretty good, but I need my own check\u00adlist. Right now I\u2019m in the sta\u00adging mode, but at some stage I\u2019ll be mov\u00ading to pro\u00adduc\u00adtion. No point fig\u00adur\u00ading out the same things twice!<\/p>\n<ol>\n<li>Devel\u00adop on laptop in a vir\u00adtualenv. Push com\u00admits reg\u00adu\u00adlarly to bit\u00adbuck\u00adet account. At some stage squash the migra\u00adtions and clean those up. Four sets of set\u00adtings: dev, test\u00ading, sta\u00adging, production.<\/li>\n<li>Set up account on Python\u00adAny\u00adwhere that allows the use of Post\u00adgres (it\u2019s an add-on to a cus\u00adtom&nbsp;plan).<\/li>\n<li>Cre\u00adate vir\u00adtualenv and set up sta\u00adging web app. Delete vir\u00adtualenv when you real\u00adise you did\u00adn\u2019t use the right ver\u00adsion of Python and the default is 2.7, not 3.5. <a href=\"https:\/\/help.pythonanywhere.com\/pages\/VirtualEnvForNewerDjango\/\">Recre\u00adate the vir\u00adtualenv with python 3.5.<\/a>\n<\/li><li>Clone the repos\u00adit\u00adory (using the <a href=\"https:\/\/confluence.atlassian.com\/bitbucket\/set-up-ssh-for-git-728138079.html\">ssh-key\u00adgen instruc\u00adtions<\/a>). Redir\u00adect the pub\u00adlic key to a file so you can copy it without line-breaks get\u00adting in the&nbsp;way.<\/li>\n<li><code>pip install -r requirements\/production.txt<\/code> (includ\u00ading psycopg2, which I did\u00adn\u2019t need for development).&nbsp;<\/li>\n<li>Cre\u00adate the Post\u00adgres serv\u00ader, user, and data\u00adbase Don\u2019t for\u00adget a strong pass\u00adword for the user (own\u00ader of the pro\u00adject database).<\/li>\n<li>Update the set\u00adtings file with the data\u00adbase settings.<\/li>\n<li><a href=\"https:\/\/help.pythonanywhere.com\/pages\/environment-variables-for-web-apps\/\">Set the envir\u00adon\u00adment vari\u00adables<\/a> for the set\u00adtings and the secret key (<a href=\"http:\/\/www.miniwebtool.com\/django-secret-key-generator\/\">gen\u00ader\u00adat\u00ador<\/a>).<\/li>\n<li>Attempt to apply the migra\u00adtions. This will show where you made mis\u00adtakes on all the pre\u00adced\u00ading&nbsp;steps.<\/li>\n<li>Fix the mis\u00adtakes. Reload the web app to see if any\u00adthing shows&nbsp;up.&nbsp;<\/li>\n<li>Set up the stat\u00adic file serv\u00ader. Check the stat\u00adic files are being served correctly.<\/li>\n<li>Cre\u00adate the Django super\u00aduser and log&nbsp;in.<\/li>\n<\/ol>\n<p>The next step is data, of course.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A check\u00adlist for mov\u00ading a Django-Wag\u00ad\u00adtail pro\u00adject to Python\u00adAny\u00adwhere. There is doc\u00adu\u00adment\u00ada\u00adtion on the Python\u00adAny\u00adwhere site; mine includes things I for\u00adget. Setup: devel\u00adop\u00adment and test\u00ading on my laptop, sta\u00adging and pro\u00adduc\u00adtion on Python\u00adAny\u00adwhere. The help files are pretty good, but I need my own check\u00adlist. Right now I\u2019m in the sta\u00adging mode, but at some \u2026 <a href=\"https:\/\/www.laurenwood.org\/anyway\/2016\/04\/setting-up-on-pythonanywhere\/\" class=\"more-link\">Con\u00adtin\u00adue read\u00ading<span class=\"screen-reader-text\"> \u201cSet\u00adting up on PythonAnywhere\u201d<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":""},"categories":[112,6],"tags":[],"class_list":["post-1444","post","type-post","status-publish","format-standard","hentry","category-django","category-technology"],"_links":{"self":[{"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/posts\/1444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":2,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"predecessor-version":[{"id":1446,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/posts\/1444\/revisions\/1446"}],"wp:attachment":[{"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laurenwood.org\/anyway\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}