DEV Community

Discussion on: Flask Vue.js Integration Tutorial

Collapse
 
ryuzakyl profile image
L

Nice work!

I was attempting to deploy the Flask API (no Vue.js for now) based on the Flask part of this tutorial, but I'm having some issues. I'm rather new with Flask :(.

I activate my virtualenv, but when running 'flask run' I keep getting the same error:

Error: While importing "wsgi", an ImportError was raised:

Traceback (most recent call last):
File "/home/ubuntu/.virtualenvs/scraphat_env/lib/python3.6/site-packages/flask/cli.py", line 235, in locate_app
import(module_name)
File "/home/ubuntu/Documents/scraphat_api/wsgi.py", line 11, in
from app import create_app
File "/home/ubuntu/Documents/scraphat_api/app/init.py", line 4, in
from .factory import Factory
File "/home/ubuntu/Documents/scraphat_api/app/factory.py", line 8, in
from .config import config
ModuleNotFoundError: No module named 'app.config'

I've also tried yo serve the Flask app with gunicorn, and get the same error.

Is there something I'm missing? I'm sure that there must be something I'm not doing right.

Any help would be appreciated.

Collapse
 
michaelbukachi profile image
Michael Bukachi

Hello. Thanks for the feedback :)
Can you confirm and check if the file config.py is present?

Collapse
 
ryuzakyl profile image
L

Thank you very much for the quick response.

The file is indeed present. Next, I show my project directory structure.

.
├── app
│ ├── config.py
│ ├── factory.py
│ ├── init.py
│ ├── models
│ │ ├── base.py
│ │ ├── database.py
│ │ ├── datastore.py
│ │ └── init.py
│ ├── resources
│ │ ├── health.py
│ │ ├── init.py
│ │ └── measures.py
│ └── utils.py
├── pytest.ini
├── README.md
├── requirements.txt
├── settings.py
├── tests
│ ├── conftest.py
│ ├── init.py
│ ├── test_app.py
│ ├── test_models.py
│ ├── test_resources.py
│ └── utils.py
├── unit-tests.sh
└── wsgi.py

Thanks for all the help.

Thread Thread
 
michaelbukachi profile image
Michael Bukachi

What do you get when you run python wsgi.py ?

Thread Thread
 
ryuzakyl profile image
L

If I do:

. workon project_env
. cd /path/to/project/root
. python wsgi.py

I get the following:

Traceback (most recent call last):
File "wsgi.py", line 11, in
from app import create_app
File "/home/ubuntu/Documents/scraphat_api/app/init.py", line 4, in
from .factory import Factory
File "/home/ubuntu/Documents/scraphat_api/app/factory.py", line 8, in
from .config import config
ModuleNotFoundError: No module named 'app.config'

Thank you for the feedback