colbyj / bride-of-frankensystem

A framework that allows for the development of custom online experiments and surveys.
GNU Lesser General Public License v3.0
12 stars 5 forks source link

Problem of jinja2.exceptions.TemplateNotFound: consent.html #27

Closed HanXiao701 closed 1 year ago

HanXiao701 commented 1 year ago

Hi, when I tried to run the examples, I noticed that there will be an exception:`

`jinja2.exceptions.TemplateNotFound: consent.html``

It seems that the file cannot be located. After relocating the consent.html to the template folder, the exception has been solved. However, no matter which URL I input, the page will always be redirected to consent.html. In that case, I am wondering whether could there be any problem with my local deployment and versions of the modules. My module versions as listed below.

Besides, the current BOFS examples do not provide much information about how to use the system (e.g. which path should we go to start), it would be great if there were more information about the best practices of BOFS. Thanks in advance.

blinker==1.6.2 bride-of-frankensystem==1.9.2 Brotli==1.1.0 click==8.1.7 colorama==0.4.6 dnspython==2.4.2 eventlet==0.33.3 Flask==2.3.3 Flask-Compress==1.14 Flask-SQLAlchemy==3.1.1 greenlet==2.0.2 itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.3 six==1.16.0 SQLAlchemy==2.0.21 toml==0.10.2 typing_extensions==4.8.0 Werkzeug==2.3.7

colbyj commented 1 year ago

Yeah, this current version of BOF in git is still a bit unstable and untested. I'm currently using it for one project successfully but there are still some details to finish up. Documentation is one of those things.

I do all my development using the advanced_example, so I'd be surprised if that one wasn't working for you. The README.md file in that repo has some instructions; basically you need to make sure your current working directory is the directory with the app's config file (like advanced.toml) and then execute BOFS advanced.toml to start up the project. If you try running from another directory BOFS won't be able to locate the files. Upon reflection, it might be best to adjust the BOFS command to set the current working directory to the specified config's directory to avoid this error.

colbyj commented 1 year ago

How are you trying to start the examples? By the way, I do appreciate your notes. I need to work on making the project more accessible.

HanXiao701 commented 1 year ago

Hi @colbyj, I followed the instructions in readme installed the BOFS in a virtual environment in Windows 11 environment, then cloned the BOFS example repo and ran BOFS advanced.toml in the folder.

I have also tried with the minimal example and unity example but they seem also do not work. I am wondering whether is it possible to have some problem with the system (e.g. difference between Windows or Linux and macOS)? Or there needs some other procedures like editing the folder name of the advanced example before starting.

I will also try to run the examples on a Linux-based server and see whether will it work or not.

colbyj commented 1 year ago

I develop on Windows 11 and deploy on a Linux server, so both of those environments are tested fairly thoroughly. It seems like somehow your working directory is not being set in the way I would expect. I'm going to adjust the BOFS command to set the working directory to the directory of the .toml file specified. Then I would appreciate if you could try that and let me know if the change worked. I'll reply again when the change is pushed. Will probably get to it this weekend.

colbyj commented 1 year ago

I was thinking about this some more. It may actually be that the default templates weren't installed properly. Does your venv\Lib\site-packages\BOFS\templates directory contain any files?

colbyj commented 1 year ago

Also put up version 1.9.2.3 onto pypi, so you can update your install of the project via pip.

HanXiao701 commented 1 year ago

Hi @colbyj, thanks for your help, after the upgrade to 1.9.2.3, the problem has been solved.

HanXiao701 commented 1 year ago

I was thinking about this some more. It may be that the default templates weren't installed properly. Does your venv\Lib\site-packages\BOFS\templates directory contain any files?

There are files in the directory, it seems that the problem has been solved by specific working directory update.