Need help setting up CircleCi and PythonAnywhere

Hey all, I’m quite new here so apologies if this is the wrong section or I’ve used a wrong tag.

I’ve been following along with this tutorial Automating Flask deployments with PythonAnywhere | CircleCI however when commiting code to Github, I get an error

I’m confused because I can’t see where I’ve went wrong having re-read the tutorial. I initially thought maybe it was because this command wasn’t being ran inside the projects virtual environment, however I’ve had difficulty trying to activate the venv in the config file as the working directory seems to be ‘/home/circleci’ instead of my pythonanywhere username ‘/home/jack…’.

Does anyone have any advice for this? I assume it is a simple mistake I’ve made somewhere but any help would be greatly appreciated.

Thanks!

Hello

Would it be possible to confirm that you are seeing this issue when setting your config.yml using the code from the Setting up CircleCI section of the link you have posted?

By default, CircleCI will use the user circleci and not the username you have set unless this is specified within the config.yml file.

The code below should be able to run successfully without any changes needing to be made

version: 2.1
orbs:
  python: circleci/python@1.2

workflows:
  build-app-with-test:
    jobs:
      - build-and-test
jobs:
  build-and-test:
    docker:
      - image: cimg/python:3.9
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: |
            pipenv --three
            pipenv install
      - run:
          name: Run tests
          command: pipenv run pytest

Kind Regards
Owen Oliver

Hi thanks for the reply. I’ve just redone the tutorial and get the same error as I did before, I’ve added the screenshot.

The only deviation from the tutorial is that I am using my own Github repo rather than the one provided. I feel like I am probably missing something really simple.

Hello

I have taken a look into this and I believe the issue is that on your repo you do not have pytest defined within your Pipfile.

Would it be possible to take a copy of the Pipfile from the repo and add it to your own.

Once this is done it should resolve your issue.

Kind Regards
Owen Oliver

Adding that and an initial Pytest solved it thanks!