swagger-api / swagger-api/swagger-codegen
[Python] ImportError: cannot import name 'FileStorage' from the generated flask server
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When I run flask-server, I get bellow ImportError.
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "python-flask-server/swagger_server/__main__.py", line 3, in <module>
import connexion
File "python-flask-server/venv/lib/python3.6/site-packages/connexion/__init__.py", line 3, in <module>
from .apis import AbstractAPI # NOQA
File "python-flask-server/venv/lib/python3.6/site-packages/connexion/apis/__init__.py", line 1, in <module>
from .abstract import AbstractAPI # NOQA
File "python-flask-server/venv/lib/python3.6/site-packages/connexion/apis/abstract.py", line 14, in <module>
from ..operation import Operation
File "python-flask-server/venv/lib/python3.6/site-packages/connexion/operation.py", line 7, in <module>
from .decorators import validation
File "python-flask-server/venv/lib/python3.6/site-packages/connexion/decorators/validation.py", line 9, in <module>
from werkzeug import FileStorage
ImportError: cannot import name 'FileStorage'
Swagger-codegen version
2.4.13
Swagger declaration file content or url
https://petstore.swagger.io/v2/swagger.json
Command line used for generation
I generated flask server from swagger-editor.
Steps to reproduce
I use venv and run swagger_server
python -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
python3 -m swagger_server
Related issues/PRs
https://github.com/zalando/connexion/issues/1149
Suggest a fix/enhancement
I can fix this bug when adding two line in reqirements.txt.
connexion == 1.1.15
python_dateutil == 2.6.0
setuptools >= 21.0.0
+ Werkzeug == 0.12.2
+ flask == 0.10.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Python Flask server's requirements.txt and reproduce the failure using the provided virtualenv and python3 -m swagger_server commands. Verify that the generated server starts without the FileStorage ImportError and that the dependency requirements match the supported generated code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100