Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Child pages (Children Display)

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