GrLdev / Rate-My-Student-Home

A website designed to allow students rate their student homes in Cardiff.
3 stars 0 forks source link

Issue running DBmaker on a fresh machine. #113

Closed tobynott80 closed 10 months ago

tobynott80 commented 1 year ago

When running db_maker.py with a fresh database, sqlalch runs into an issue of trying to access tables before theyre created.

Issue

`Traceback (most recent call last): File "C:\Users\tobyn\Documents\Side Projects\Rate-My-Student-Home\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1963, in _exec_single_context self.dialect.do_execute( File "C:\Users\tobyn\Documents\Side Projects\Rate-My-Student-Home\venv\Lib\site-packages\sqlalchemy\engine\default.py", line 920, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: no such table: halls

The above exception was the direct cause of the following exception:

Traceback (most recent call last): ........ File "C:\Users\tobyn\Documents\Side Projects\Rate-My-Student-Home\venv\Lib\site-packages\sqlalchemy\engine\default.py", line 920, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: halls [SQL: SELECT halls.id AS halls_id, halls.property_id AS halls_property_id, halls.rent AS halls_rent FROM halls]`

This is due to line 2 where app is imported, running app\__init__.py where in line 24 routes and models is imported unnecessarily, causing a headache with the forms.py code.

Solution

Remove unnecessary code in line 24 in init

tobynott80 commented 1 year ago

~Issue is resolved, pending review and merge~

Issue is not solved - issue varies by machine, ignoring for now...

moahmed0987 commented 10 months ago

believe i can find a fix, will update

moahmed0987 commented 10 months ago

issue was fixed in the linked pr, closing this issue