Closed ben1628 closed 1 year ago
it looks like it fails on orders/models.py at line 10
from backports.zoneinfo import ZoneInfo
I'm using python 3.10.6, the following seems to be the proper syntax
from zoneinfo import ZoneInfo
There are other modules that have similar problems
However, the error still occurred if I tried to run the same script again, don't know what's wrong with it.
Hi, first all jupyter scripts need to be moved one folder higher to work (still haven't found a solution to that, the classic one is to integrate my tool in pip and let you install it from there). This is what I meant with MOVE_THEM_TO_ROOT_TO_USE_THEM. I did not put all scripts there from the beginning, otherwise it looks very messy.
For the zoneinfo, you are right with Python 3.8 and below you need the backports, with newer Python zoneinfo works directly. I will put a "if" there.
Okay, I resolved the problem by doing the following
import sys
sys.path.append(".")
from core import strat, indicators, bt
and then modify the settings.py at line 145
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
...
if DEBUG and DEBUG!="False":
with open(os.path.join(BASE_DIR, 'trading_bot/etc/DJANGO_SECRET')) as f:
SECRET_KEY = f.read().strip()
with open(os.path.join(BASE_DIR, 'trading_bot/etc/DB_SECRET')) as f:
DB_SECRET_KEY = f.read().strip()
with open(os.path.join(BASE_DIR, 'trading_bot/etc/DB_USER')) as f:
DB_USER = f.read().strip()
BASE_DIR is the new settings.py as of Django 4.1.6 when I created the website from scratch.
The os.path.join(BASE_DIR, is a good idea indeed, I neglected this point. However with the sys append(".") I am not able to start the jupyter scripts from a subordner, so I don't really see the change in comparison to before. Maybe I misunderstand your actions.
may be try it with two dots like this
import sys
sys.path.append("..")
from core import strat, indicators, bt
It did worked for me.
It made my day, many thx!
Many thanks to you, you're a great help for me! :)
Trying to run the bt.ipynb and get the above error
any ideas?