According to this, I am trying to run my flask web application from my com_profiler directory as python -m api.index, python -m api.index.py, python api/index.py. But none of these are working. The errors I am getting are in the order -
-> ValueError: attempted relative import beyond top-level package
-> attempted relative import beyond top-level package
-> SystemError: Parent module '' not loaded, cannot perform relative import
 
Directory Structure:
comp_profiler/
├── api
│   ├── bootstrap.sh
│   ├── index.py
│   └── __init__.py
├── __init__.py
├── pipelines.py
├── random_useragent.py
├── requirements.txt
├── scrapy.cfg
├── spiders
│   ├── __init__.py
│   ├── content_handler.py
│   ├── core_spider.py
│   ├── middlewares.py
│   ├── scrapper
│   │   ├── __init__.py
│   │   ├── corporatedir.py
│   │   ├── craft.py
│   │   ├── tofler.py
│   │   └── zaubacorp.py
│   ├── scrapper.py
│   ├── seed_list_generator.py
│   ├── settings.py
│   └── utility.py
index.py
from flask import Flask, request, jsonify
from ..spiders.seed_list_generator import SeedListGenerator
app = Flask(__name__)
@app.route("/start-spider")
def hello_world():
    spider = SeedListGenerator()
    company_name = request.get_json()
    print(company_name)
    return "Hello world"
if __name__ == "__main__":
    app.run()
I also tried running it from api directory, but no success.
Kindly let me know if I am missing something with flask setup, as I am just starting up with flask.
Update: I want to integrate SeedListGenerator as API call. Kindly suggest.
Thanks in advance.
