youngestdev / async-fastapi-mongo Goto Github PK
View Code? Open in Web Editor NEWRepository housing code for the Testdriven article.
License: MIT License
Repository housing code for the Testdriven article.
License: MIT License
Got the following error:
(my_venv) [root@centos-s-1vcpu-1gb-intel-nyc1-01 async-fastapi-mongo]# python app/main.py
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: Started reloader process [96543] using statreload
Process SpawnProcess-1:
Traceback (most recent call last):
File "/usr/lib64/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib64/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/subprocess.py", line 62, in subprocess_started
target(sockets=sockets)
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/main.py", line 390, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/main.py", line 397, in serve
config.load()
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/config.py", line 278, in load
self.loaded_app = import_from_string(self.app)
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/importer.py", line 23, in import_from_string
raise exc from None
File "/root/my_venv/lib/python3.8/site-packages/uvicorn/importer.py", line 20, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib64/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/root/my_venv/async-fastapi-mongo/app/server/app.py", line 3, in
from app.server.routes.student import router as StudentRouter
ModuleNotFoundError: No module named 'app'
When I am running the API my console shows:
from app.server.routes.student import router as StudentRouter
ModuleNotFoundError: No module named 'app'.
How do I rectify it?
Please guide
I noticed in your blog post that you had mentioned using Fixie Socks to restrict access to the MongoDB Atlas Database. I'm curious if that is a step you were able to successfully implement. I have done something pretty close to the app you describe here and I really like how easy MongoDB Atlas is to work with, but I am having troubles using it with Heroku because Heroku doesn't have static IPs available except for enterprise tier customers. I tried using Fixie, Fixie Socks, and Quota Guard, but I don't think I am using them quite properly because when I install them as add-ons, my fastapi backend still tries to call Atlas directly. From what I can tell these add-ons basically just turn into a proxy server, but I'm not sure how to tell my application to pass traffic through. If you have any advice on getting this to work, I would be super interested!
I am trying to run server, But I have got the following error
from app.server.routes.studento\app\server\app.py", line 3, in < import router as StudentRouter
ModuleNotFoundError: No module nam import router as StudentRouter ed 'app'
Hey man I'm following alone of your tutorial, greate stuff but I'm stucking at this error
~/Documents/Work/OMZ/async-fastapi-mongo/app master fastapi โฏ python main.py INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: Started reloader process [4440] using watchgod Process SpawnProcess-1: Traceback (most recent call last): File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/subprocess.py", line 61, in subprocess_started target(sockets=sockets) File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/server.py", line 48, in run loop.run_until_complete(self.serve(sockets=sockets)) File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/server.py", line 55, in serve config.load() File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/config.py", line 308, in load self.loaded_app = import_from_string(self.app) File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/importer.py", line 23, in import_from_string raise exc from None File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/site-packages/uvicorn/importer.py", line 20, in import_from_string module = importlib.import_module(module_str) File "/Users/lavendermp/anaconda3/envs/fastapi/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 790, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/Users/lavendermp/Documents/Work/OMZ/async-fastapi-mongo/app/server/app.py", line 3, in <module> from app.server.routes.student import router as StudentRouter ModuleNotFoundError: No module named 'app'
any idea to solve it?
is it good to try? because, I'll already visit your app, that's error dude..
File "D:\Project\async-fastapi-mongo\venv\Lib\site-packages\decouple.py", line 92, in get
raise UndefinedValueError('{} not found. Declare it as envvar or define a default value.'.format(option))
decouple.UndefinedValueError: MONGO_DETAILS not found. Declare it as envvar or define a default value.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.