CiscoDevNet / yang-explorer

An open-source Yang Browser and RPC Builder Application
Apache License 2.0
440 stars 176 forks source link

guest/guest login on OSX with Safari fails #8

Closed NathanDotTo closed 9 years ago

NathanDotTo commented 9 years ago

[05/Oct/2015 14:17:11]"GET /static/YangExplorer.html HTTP/1.1" 200 6604 [05/Oct/2015 14:17:11]"GET /static/history/history.css HTTP/1.1" 200 1209 [05/Oct/2015 14:17:11]"GET /static/swfobject.js HTTP/1.1" 200 10220 [05/Oct/2015 14:17:11]"GET /static/history/history.js HTTP/1.1" 200 26166 [05/Oct/2015 14:17:11]"GET /static/YangExplorer.swf HTTP/1.1" 200 2996445 [05/Oct/2015 14:17:12] WARNING [django.request] Not Found: /favicon.ico WARNING:django.request:Not Found: /favicon.ico [05/Oct/2015 14:17:12]"GET /favicon.ico HTTP/1.1" 404 2314 [05/Oct/2015 14:17:13]"GET /explorer/session HTTP/1.1" 200 67 [05/Oct/2015 14:17:36] ERROR [django.request] Internal Server Error: /explorer/login Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(_args, _kwargs) File "/Users/nathan/git/yang-explorer/server/explorer/views.py", line 52, in login_handler login(request, user) File "/Library/Python/2.7/site-packages/django/contrib/auth/init.py", line 110, in login request.session.cycle_key() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key self.create() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 41, in create self.save(must_create=True) File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 65, in save obj.save(force_insert=must_create, using=using) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 710, in save force_update=force_update, update_fields=update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 738, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 822, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 861, in _do_insert using=using, raw=raw) File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(_args, _kwargs) File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 920, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/utils.py", line 97, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute return Database.Cursor.execute(self, query, params) OperationalError: attempt to write a readonly database ERROR:django.request:Internal Server Error: /explorer/login Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(_args, _kwargs) File "/Users/nathan/git/yang-explorer/server/explorer/views.py", line 52, in login_handler login(request, user) File "/Library/Python/2.7/site-packages/django/contrib/auth/init.py", line 110, in login request.session.cycle_key() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key self.create() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 41, in create self.save(must_create=True) File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 65, in save obj.save(force_insert=must_create, using=using) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 710, in save force_update=force_update, update_fields=update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 738, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 822, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 861, in _do_insert using=using, raw=raw) File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(_args, _kwargs) File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 920, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/utils.py", line 97, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute return Database.Cursor.execute(self, query, params) OperationalError: attempt to write a readonly database [05/Oct/2015 14:17:37]"POST /explorer/login HTTP/1.1" 500 142905 [05/Oct/2015 14:17:48] ERROR [django.request] Internal Server Error: /explorer/login Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(_args, _kwargs) File "/Users/nathan/git/yang-explorer/server/explorer/views.py", line 52, in login_handler login(request, user) File "/Library/Python/2.7/site-packages/django/contrib/auth/init.py", line 110, in login request.session.cycle_key() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key self.create() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 41, in create self.save(must_create=True) File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 65, in save obj.save(force_insert=must_create, using=using) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 710, in save force_update=force_update, update_fields=update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 738, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 822, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 861, in _do_insert using=using, raw=raw) File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(_args, _kwargs) File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 920, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/utils.py", line 97, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute return Database.Cursor.execute(self, query, params) OperationalError: attempt to write a readonly database ERROR:django.request:Internal Server Error: /explorer/login Traceback (most recent call last): File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, _callback_args, _callback_kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view return view_func(_args, _kwargs) File "/Users/nathan/git/yang-explorer/server/explorer/views.py", line 52, in login_handler login(request, user) File "/Library/Python/2.7/site-packages/django/contrib/auth/init.py", line 110, in login request.session.cycle_key() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/base.py", line 285, in cycle_key self.create() File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 41, in create self.save(must_create=True) File "/Library/Python/2.7/site-packages/django/contrib/sessions/backends/db.py", line 65, in save obj.save(force_insert=must_create, using=using) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 710, in save force_update=force_update, update_fields=update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 738, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 822, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 861, in _do_insert using=using, raw=raw) File "/Library/Python/2.7/site-packages/django/db/models/manager.py", line 127, in manager_method return getattr(self.get_queryset(), name)(_args, _kwargs) File "/Library/Python/2.7/site-packages/django/db/models/query.py", line 920, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/Library/Python/2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/utils.py", line 97, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Library/Python/2.7/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/Library/Python/2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute return Database.Cursor.execute(self, query, params) OperationalError: attempt to write a readonly database [05/Oct/2015 14:17:48]"POST /explorer/login HTTP/1.1" 500 142905

NathanDotTo commented 9 years ago

The problem here is that one needs to install as sudo, else the dependencies installs fails, but, by doing so, one ends up creating a database that needs to be accessed as sudo. So, one needs to do this to get the system to work:

sudo ./start.sh

einarnn commented 9 years ago

When running setup.sh, it will create and use a virtualenv if you have it installed. This should allow the tool to be installed without root privileges and hence to subsequently be run as a non-root user.

How did you install it?

NathanDotTo commented 9 years ago

Hi

I did not use virtualenv, I installed using sudo.

Regards

Nathan

On 5 Oct 2015, at 17:04, Einar Nilsen-Nygaard notifications@github.com wrote:

When running setup.sh, it will create and use a virtualenv if you have it installed. This should allow the tool to be installed without root privileges and hence to subsequently be run as a non-root user.

How did you install it?

— Reply to this email directly or view it on GitHub.

Nathan John Sowatskey Programmable Infrastructure, DevOps and SDN nathan@nathan.to www.linkedin.com/in/nathandevops XMPP: nathandotto@im.koderoot.net Google: nathanjohnsowatskey@gmail.com Skype: nathan_sowatskey Twitter: NathanDotTo http://www.kipling.org.uk/poems_if.htm

pgohite commented 9 years ago

Hi Nathan,

Does it work when you start with sudo ? If that is the case we just need to document it ?

Thanks, Pravin

NathanDotTo commented 9 years ago

It works when started with sudo.

Regards

Nathan

On 5 Oct 2015, at 18:30, Pravin Gohite notifications@github.com wrote:

Hi Nathan,

Does it work when you start with sudo ? If that is the case we just need to document it ?

Thanks, Pravin

— Reply to this email directly or view it on GitHub.

Nathan John Sowatskey Programmable Infrastructure, DevOps and SDN nathan@nathan.to www.linkedin.com/in/nathandevops XMPP: nathandotto@im.koderoot.net Google: nathanjohnsowatskey@gmail.com Skype: nathan_sowatskey Twitter: NathanDotTo http://www.kipling.org.uk/poems_if.htm

pgohite commented 9 years ago

Suggested Changes:

patch_8.txt

Please let me know if this looks good

Thanks, Pravin

einarnn commented 9 years ago

Hmm. Would it make sense to update setup.sh to only run the parts that need to be run under root privileges if necessary? And to explicitly setup the database, etc., as a non-root user? (Which you can do if you're running under root privileges.)

pgohite commented 9 years ago

You mean by individually adding "sudo" to the commands which might require sudo access in setup.py ?

einarnn commented 9 years ago

No, I really meant is something like:

pgohite commented 9 years ago

Done