garettB/shopify-flask-example

question about flask app

Opened this issue · 3 comments

Hello,

I am trying to build a shopify flask app using your guide here but the code does not work on my local environment. I have already updated the config file although I think the problem is there as I get the 'SyntaxError: invalid syntax' error when running server.py.

if you are getting this error

  File "src/server.py", line 76
    logging.error(f"webhook call received {webhook_topic}:\n{json.dumps(webhook_payload, indent=4)}")
                                                                                                   ^
SyntaxError: invalid syntax

It might be from you running

python src/server.py

Instead, try running

python3 src/server.py

This is because f-strings were only introduced in python 3

this app working fine as per the documents mention

hoe run shopify flask app in localhost

system specification

OS Ubuntu 20.04 LST

python
Python 3.8.5 (default, Jan 27 2021, 15:41:15) 

installing python pip3

$ sudo apt-get install python3-pip

[option ] you can you system python environments

$ sudo apt install python3-virtualenv
$ sudo apt-get install python3-venv

creating python virtual environments

$ python3 -m venv myvenv

Activate the virtual environments

$ source myvenv/bin/activate

now your terminal look likes
(myvenv) user@sys $

download the code from https://github.com/garettB/shopify-flask-example/archive/refs/heads/master.zip
[ or you can clone use for git ]

(myvenv) user@sys $ #goto code root directory
(myvenv) user@sys $ ll #chech the requirements.txt avalable in curent path
(myvenv) user@sys $ pip3 install -r requirements.txt
(myvenv) user@sys $ cd src/
(myvenv) user@sys $ cp .env.template .env

@samistat08 please check this