Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

  • Create a new repository on Bitbucket / GitHub
    • Bitbucket:
      • Go to https://bitbucket.org/
        • If you need to log in, get the login credentials from LastPass.
      • Click 'Repositories' and then 'Create repository'.
      • After you pick a name you'll be presented with a new screen.
      • Click "Clone".
      • Copy the command it shows you.
      • Switch to PythonAnywhere's website
  • Clone the new repository in PythonAnywhere.
    • Create a new bash console.
    • If you're not already in the root directory, type "cd ~" and hit enter.
    • Take the command you copied from Bitbucket and paste it into the console and hit "Enter".
  • Clone the new repository in SourceTree.
    • Open SourceTree (it's software you keep on your computer).
    • Click 'Clone'
    • A dialog box will pop up. Click the button on the top-right to be shown a list of your online Bitbucket projects.
      • When you've selected it, the only thing you should have left to click is "Clone".
  • Create a PyCharm project in the new directory that SourceTree created on your hard drive.
    • Navigate to the folder.
    • Click 'Create'.
    • It'll ask you if you want to create the project from existing sources. Click 'Yes'.
  • Create a virtualenv with PyCharm.
    • With the project open, go to 'File' → 'Settings'
    • Navigate to "Project: project_name" → "Project Intepreter"
    • Click the gear icon in the top right and select "Create new virtualenv".
    • Fill out the "Location" and "Base interpreter" fields.
      • Location:
        • Navigate to the project folder.
      • Name: Once you've selected the project folder, type 'venv' in the 'Name' field. This will create a new folder named 'venv' in the project folder.
      • Base interpreter: I'm guessing it's probably a good idea to set the base Python interpreter to be the same version as that used on PythonAnywhere.
        • To get the version used on PythonAnywhere, I start a Python session.
        • To install that version of Python, just go to the main Python website.
        • When it's installing, I made a note of the directory it was installed to.
        • The 'AppData' installation directory didn't show up in PyCharm because it's hidden.
        • ...so I navigated to the directory in Windows Explorer and copied the path.
        • I then copied that path into PyCharm and added '/python.exe' to the end, and it found the file.
    • If it all works, you should see a screen like the one below. Click 'OK' to save the changes.
  • Use SourceTree to push the new venv folder / files to the Bitbucket repository.
    • If you switch back to SourceTree you should see a list of files that SourceTree has noticed as being new.
    • We don't want to have our PyCharm files in the git repository (I think), so navigate to 'Actions' → 'Ignore'
    • Select 'Ignore everything beneath: .idea'
    • Once that's done those '.idea' files should disappear from the list of Unstaged files.
    • Select the box next to 'Unstaged files' to select the remaining files to be committed. (Note: the path for my venv files in the pics below isn't correct because I messed up the location of my venv the first time I created it. So ignore the paths you see in the screenshots.)
    • Click the 'Commit' button.
    • Fill out some brief explanation of what you're committing and click the 'Commit' button.
    • Click the 'Push' button.
    • Select the 'Push?' box and click 'OK'.
    • You should see it switch to a progress bar.
    • Once it's finished, you can go to Bitbucket in your browser and confirm that the files were uploaded:
  • In PythonAnywhere, pull the new changes.
    • Open a bash console and switch into the project folder.
    • Run 'git pull'.
    • It'll prompt you for the Bitbucket password; it's in LastPass.
  • No labels