sfu-natlang / lensingwikipedia

Lensing Wikipedia is an interface to visually browse through human history as represented in Wikipedia. This the source code that runs the website:
http://lensingwikipedia.cs.sfu.ca
Other
11 stars 4 forks source link

Unable to use frontend locally #214

Closed theq629 closed 7 years ago

theq629 commented 7 years ago

I just tried to setup the frontend locally following the readme and it doesn't seem to work. At step 2:

$ pip install -r requirements.txt
Collecting alembic==0.8.6 (from -r requirements.txt (line 1))
Collecting defusedxml==0.4.1 (from -r requirements.txt (line 2))
Collecting Flask==0.10.1 (from -r requirements.txt (line 3))
Collecting Flask-Login==0.2.11 (from -r requirements.txt (line 4))
Collecting Flask-Migrate==1.6.0 (from -r requirements.txt (line 5))
Collecting Flask-Script==2.0.5 (from -r requirements.txt (line 6))
Collecting Flask-SQLAlchemy==2.0 (from -r requirements.txt (line 7))
Collecting Flask-WTF==0.12 (from -r requirements.txt (line 8))
Collecting itsdangerous==0.24 (from -r requirements.txt (line 9))
Collecting Jinja2==2.8 (from -r requirements.txt (line 10))
  Using cached Jinja2-2.8-py2.py3-none-any.whl
Collecting Mako==1.0.4 (from -r requirements.txt (line 11))
Collecting MarkupSafe==0.23 (from -r requirements.txt (line 12))
Collecting oauthlib==1.1.2 (from -r requirements.txt (line 13))
Collecting pkg-resources==0.0.0 (from -r requirements.txt (line 14))
  Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 14)) (from versions: )
No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 14))

If I install all the other requirements (except pkg-resources) and proceed to step 3:

$ python run.py create_db
Traceback (most recent call last):
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 77, in _compiler_dispatch
    meth = getter(visitor)
AttributeError: 'SQLiteTypeCompiler' object has no attribute 'visit_JSON'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2280, in visit_create_table
    and not first_pk)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
    return meth(self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2311, in visit_create_column
    first_pk=first_pk
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/dialects/sqlite/base.py", line 865, in get_column_specification
    column.type, type_expression=column)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 279, in process
    return type_._compiler_dispatch(self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch
    raise exc.UnsupportedCompilationError(visitor, cls)
sqlalchemy.exc.UnsupportedCompilationError: Compiler <sqlalchemy.dialects.sqlite.base.SQLiteTypeCompiler object at 0x7f6c9fa1e630> can't render element of type <class 'sqlalchemy.sql.sqltypes.JSON'>

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

Traceback (most recent call last):
  File "run.py", line 4, in <module>
    manager.run()
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/commands.py", line 216, in __call__
    return self.run(*args, **kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/app/__init__.py", line 71, in create_db
    db.create_all()
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_sqlalchemy/__init__.py", line 895, in create_all
    self._execute_for_all_tables(app, bind, 'create_all')
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_sqlalchemy/__init__.py", line 887, in _execute_for_all_tables
    op(bind=self.get_engine(app, bind), **extra)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/schema.py", line 3826, in create_all
    tables=tables)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1917, in _run_visitor
    conn._run_visitor(visitorcallable, element, **kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1526, in _run_visitor
    **kwargs).traverse_single(element)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
    return meth(obj, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 733, in visit_metadata
    _is_metadata_operation=True)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
    return meth(obj, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 767, in visit_table
    include_foreign_key_constraints=include_foreign_key_constraints
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 947, in execute
    return meth(self, multiparams, params)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
    return connection._execute_ddl(self, multiparams, params)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 998, in _execute_ddl
    if not self.schema_for_object.is_default else None)
  File "<string>", line 1, in <lambda>
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 433, in compile
    return self._compiler(dialect, bind=bind, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 26, in _compiler
    return dialect.ddl_compiler(dialect, self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 208, in __init__
    self.string = self.process(self.statement, **compile_kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
    return meth(self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2291, in visit_create_table
    (table.description, column.name, ce.args[0])
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2280, in visit_create_table
    and not first_pk)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process
    return obj._compiler_dispatch(self, **kwargs)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch
    return meth(self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2311, in visit_create_column
    first_pk=first_pk
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/dialects/sqlite/base.py", line 865, in get_column_specification
    column.type, type_expression=column)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 279, in process
    return type_._compiler_dispatch(self, **kw)
  File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch
    raise exc.UnsupportedCompilationError(visitor, cls)
sqlalchemy.exc.CompileError: (in table 'tab', column 'config'): Compiler <sqlalchemy.dialects.sqlite.base.SQLiteTypeCompiler object at 0x7f6c9fa1e630> can't render element of type <class 'sqlalchemy.sql.sqltypes.JSON'>

Using python 2 fails with a different error, and proceeding directly to step 6 (which worked in the past) doesn't work any more.

avacariu commented 7 years ago

The error is probably because SQLite doesn't support the JSON datatype. You'd need to use Postgres, but that can be a bit annoying to set up, so I'd suggest using Docker to handle everything. If you prefer to just run Postgres instead, I can add instructions to do that to the README. The issue with supporting running stuff outside of Docker, though, is that you might miss bugs that will somehow only happen within that specific environment.

The pip issue with the pkg-resources seems to be a bug within pip. pip freeze will add it in, and then pip install will fail. Apparently no one else is finding this to be a real issue, so I'm dealing with it by removing that line before running pip install somewhere in the Dockerfile.

In terms of using Docker for local development, I haven't gotten around to finishing that up. It should be sufficient to use volumes in the development docker-compose.yml to mount the local code on top of the one in the containers. You can also attach a shell to a running container if you need it.

I'll take a look at polishing all this up, but I can't do much this week unfortunately.

Best,

Andrei Vacariu

From: Max Whitney

Sent: Monday, October 3, 08:06

Subject: [sfu-natlang/lensingwikipedia] Unable to use frontend locally (#214)

To: sfu-natlang/lensingwikipedia

I just tried to setup the frontend locally following the readme and it doesn't seem to work. At step 2:

"""

$ pip install -r requirements.txt

Collecting alembic==0.8.6 (from -r requirements.txt (line 1))

Collecting defusedxml==0.4.1 (from -r requirements.txt (line 2))

Collecting Flask==0.10.1 (from -r requirements.txt (line 3))

Collecting Flask-Login==0.2.11 (from -r requirements.txt (line 4))

Collecting Flask-Migrate==1.6.0 (from -r requirements.txt (line 5))

Collecting Flask-Script==2.0.5 (from -r requirements.txt (line 6))

Collecting Flask-SQLAlchemy==2.0 (from -r requirements.txt (line 7))

Collecting Flask-WTF==0.12 (from -r requirements.txt (line 8))

Collecting itsdangerous==0.24 (from -r requirements.txt (line 9))

Collecting Jinja2==2.8 (from -r requirements.txt (line 10))

Using cached Jinja2-2.8-py2.py3-none-any.whl

Collecting Mako==1.0.4 (from -r requirements.txt (line 11))

Collecting MarkupSafe==0.23 (from -r requirements.txt (line 12))

Collecting oauthlib==1.1.2 (from -r requirements.txt (line 13))

Collecting pkg-resources==0.0.0 (from -r requirements.txt (line 14))

Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 14)) (from versions: )

No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 14))

"""

If I install all the other requirements (except pkg-resources) and proceed to step 3:

"""

$ python run.py create_db

Traceback (most recent call last):

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 77, in _compiler_dispatch

meth = getter(visitor)

AttributeError: 'SQLiteTypeCompiler' object has no attribute 'visit_JSON'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2280, in visit_create_table

and not first_pk)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process

return obj.compiler_dispatch(self, *kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch

return meth(self, *kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2311, in visit_create_column

first_pk=first_pk

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/dialects/sqlite/base.py", line 865, in get_column_specification

column.type, type_expression=column)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 279, in process

return type._compiler_dispatch(self, **kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch

raise exc.UnsupportedCompilationError(visitor, cls)

sqlalchemy.exc.UnsupportedCompilationError: Compiler can't render element of type

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

Traceback (most recent call last):

File "run.py", line 4, in

manager.run()

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/init.py", line 412, in run

result = self.handle(sys.argv[0], sys.argv[1:])

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/init.py", line 383, in handle

res = handle(args, *config)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_script/commands.py", line 216, in call

return self.run(args, *kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/app/init.py", line 71, in create_db

db.create_all()

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_sqlalchemy/init.py", line 895, in create_all

self.execute_for_all_tables(app, bind, 'create_all')

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/flask_sqlalchemy/_init.py", line 887, in execute_for_all_tables

op(bind=self.get_engine(app, bind), *extra)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/schema.py", line 3826, in create_all

tables=tables)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1917, in _run_visitor

conn._run_visitor(visitorcallable, element, *kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1526, in run_visitor

*kwargs).traverse_single(element)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single

return meth(obj, *kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 733, in visit_metadata

_is_metadata_operation=True)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single

return meth(obj, *kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 767, in visit_table

include_foreign_key_constraints=include_foreign_key_constraints

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 947, in execute

return meth(self, multiparams, params)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection

return connection._execute_ddl(self, multiparams, params)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 998, in _execute_ddl

if not self.schema_for_object.is_default else None)

File "", line 1, in

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/elements.py", line 433, in compile

return self._compiler(dialect, bind=bind, *kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 26, in _compiler

return dialect.ddl_compiler(dialect, self, **kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 208, in __init

self.string = self.process(self.statement, *compile_kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process

return obj._compiler_dispatch(self, *kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in compiler_dispatch

return meth(self, *kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2291, in visit_create_table

(table.description, column.name, ce.args[0])

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause

reraise(type(exception), exception, tb=exc_tb, cause=cause)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 185, in reraise

raise value.with_traceback(tb)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2280, in visit_create_table

and not first_pk)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 231, in process

return obj._compiler_dispatch(self, *kwargs)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch

return meth(self, **kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 2311, in visit_create_column

first_pk=first_pk

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/dialects/sqlite/base.py", line 865, in get_column_specification

column.type, type_expression=column)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/compiler.py", line 279, in process

return type._compiler_dispatch(self, **kw)

File "/home/mwhitney/projects/lensingwikipedia/repo/web/venv/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch

raise exc.UnsupportedCompilationError(visitor, cls)

sqlalchemy.exc.CompileError: (in table 'tab', column 'config'): Compiler can't render element of type

"""

Using python 2 fails with a different error, and proceeding directly to step 6 (which worked in the past) doesn't work any more.

You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or mute the thread.

anoopsarkar commented 7 years ago

what specifically needs to be "polished" up @avacariu ?

theq629 commented 7 years ago

I did a docker build with the Dockerfile and then after some playing around got an accessible server going as:

docker run -p 5000:5000 lensing python3 /opt/lensing/run.py runserver -h 0.0.0.0 -p 5000 -d

However, when trying to access the site the server still gives database errors:

$ docker run -p 5000:5000 lensing python3 /opt/lensing/run.py runserver -h 0.0.0.0 -p [mwhitney@este web]$ docker run -p 5000:5000 lensing python3 /opt/lensing/run.py runserver -h 0.0.0.0 -p 5000 -d
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
/usr/local/lib/python3.5/dist-packages/werkzeug/filesystem.py:63: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use UTF-8 as filesystem encoding instead of 'ascii'
  BrokenFilesystemWarning)
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/lensing/app/views.py", line 58, in index
    visible_tabs = Tab.query.filter(Tab.visible.is_(True)).all()
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2625, in all
    return list(self)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2777, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/query.py", line 2800, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 947, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/sql/elements.py", line 262, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1055, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1191, in _execute_context
    context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1386, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/util/compat.py", line 185, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/base.py", line 1184, in _execute_context
    context)
  File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/engine/default.py", line 462, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: tab [SQL: 'SELECT tab.name AS tab_name, tab.external_name AS tab_external_name, tab.visible AS tab_visible, tab."order" AS tab_order, tab.config AS tab_config \nFROM tab \nWHERE tab.visible IS 1']
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
172.17.0.1 - - [08/Oct/2016 03:22:43] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

For basic frontend development it would be nice to have a way to use the site without needing docker (which seems to need access to a daemon running as root), and maybe without including the database (which introduces a lot of dependencies and isn't needed for basic use of the site).

avacariu commented 7 years ago

How did you set up the database when building using Docker? According to the exception, the SQLite database it's connecting to doesn't have any tables in it.

The site should run fine outside of Docker, but you just need to do more configuration of it (using the local_config.py) to match your environment. I've never run it outside of Docker myself, though, because I want to have the exact same environment as on production to avoid weird bugs.

All the configuration for the tabs (including which tabs are enabled) is stored in the database, so it sort of is needed for basic use of the site. We can add code to handle both cases of "database is there" and "database isn't there", but I've tried to avoid adding more code than is necessary, and storing stuff in the database reduces the number of places you have to keep track of configuration. I'll look into how SQLite can be made to handle JSON, although I've found issues with using SQLite locally and having it seem to work but then hitting weird bugs when deploying the site (e.g. SQLite won't enforce constraints unless you explicitly tell it to, so I ended up in situations where code that shouldn't work did while using SQLite).

@anoopsarkar By "polishing up" I meant going through everything and making sure that local development works smoothly. Looking at the code, though, I see that for local development one only needs to run make dev to have a fully functioning copy of the site locally, so all I want to do is figure out how to fix the SQLite and JSON issue.

avacariu commented 7 years ago

@theq629 I've pushed a new commit to the develop branch which will compile JSON as TEXT when using SQLite. Creating the database seems to work for me now, and the site loads. The instructions in the README that you tried following in your first comment are still valid (I just changed the virtualenv to python3 -m venv, but that's minor). Other than that, the site seems to be functioning for me (although I didn't set up a query backend when I tested it).

Can you try it out and let me know if you have any issues?

theq629 commented 7 years ago

The new commit is working fine for me after I manually skip pkg-resources again.

When I tried docker I believe I just did "docker build ." in web/, I couldn't work out what I else I should do to build it.

anoopsarkar commented 7 years ago

update the docs?