[Mayan EDMS: 2032] Trouble with debug/runserver on 2.6.4

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2032] Trouble with debug/runserver on 2.6.4

MacRobb Simpson
Hello,

I'm running into a little bit of trouble getting static files served using the 'mayan-edms.py runserver' command I used in earlier versions.

My goal is to basically have it working like I did in 2.1 - I simply run the 'runserver' command, and I have a development environment running; each load of a file is logged to the console and everything is great!

Currently, what I have is it serving the main content, but no static files - all static requests return 500 errors.

My setup is as follows:
1. Debian x64 system
2. Mayan is installed in a virtualenv using pip ("pip install mayan-edms").
3. I've created a 'local.py' file in '/lib/python2.7/site-packages/mayan/settings/' and added 'DEBUG=True', as shown here: https://gitlab.com/mayan-edms/mayan-edms/issues/368
4. I've verified that my local.py file is being picked up - I've deleted all the .pyc files in that directory, and when I run the runserver command, it creates 'local.pyc' again.

When I run it using the runserver command, I get no errors, and no logging of anything in the console, not even the browser request that brings me to the login screen(which obviously returns 200 in the browser).
(It *is* being loaded from this instance of Mayan, however - killing the runserver command, the page doesn't load at all, as expected).

Any ideas on how to make debug mode work?

Thanks,

-Rob


--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2037] Re: Trouble with debug/runserver on 2.6.4

rosarior
Administrator
Hi,

I was not able to reproduce your issue. Error 500 for static media means the DEBUG=True statement is not being picked up by Django. Make sure you are editing the local.py inside the virtualenv and not in the root installation of Python (your path has an initial '/'). Unlikely but just in case.

Also make sure there are no other hanged processes using:

ps x a| grep 'mayan'

Sometimes previous runserver commands can remain in a Linux zombie process.

Finally, try this exactly as typed and check static media to discard any library difference with the OS.

cd /tmp
virtualenv venv
source venv/bin/activate
pip install mayan-edms==2.6.4
mayan-edms.py initialsetup
echo "DEBUG=True" >> venv/lib/python2.7/site-packages/mayan/settings/local.py
mayan-edms.py runserver

Browse to localhost:8000

Check static files directly: http://127.0.0.1:8000/static/appearance/css/base.css

Let me know how it goes.

On Tuesday, August 22, 2017 at 10:55:03 AM UTC-4, MacRobb Simpson wrote:
Hello,

I'm running into a little bit of trouble getting static files served using the 'mayan-edms.py runserver' command I used in earlier versions.

My goal is to basically have it working like I did in 2.1 - I simply run the 'runserver' command, and I have a development environment running; each load of a file is logged to the console and everything is great!

Currently, what I have is it serving the main content, but no static files - all static requests return 500 errors.

My setup is as follows:
1. Debian x64 system
2. Mayan is installed in a virtualenv using pip ("pip install mayan-edms").
3. I've created a 'local.py' file in '/lib/python2.7/site-packages/mayan/settings/' and added 'DEBUG=True', as shown here: <a href="https://gitlab.com/mayan-edms/mayan-edms/issues/368" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms/issues/368
4. I've verified that my local.py file is being picked up - I've deleted all the .pyc files in that directory, and when I run the runserver command, it creates 'local.pyc' again.

When I run it using the runserver command, I get no errors, and no logging of anything in the console, not even the browser request that brings me to the login screen(which obviously returns 200 in the browser).
(It *is* being loaded from this instance of Mayan, however - killing the runserver command, the page doesn't load at all, as expected).

Any ideas on how to make debug mode work?

Thanks,

-Rob


--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2054] Re: Trouble with debug/runserver on 2.6.4

MacRobb Simpson
First off, sorry for taking so long for a response.

Doing exactly that... worked.
Upon troubleshooting, the only thing different between this 'clean' copy and mine was the local.py config file, where I had a few extra settings - Mysql DB setup for the DB, ldap for authentication.
What I eventually found is that, if you don't have the Mysql or ldap packages installed vin your virtualenv, instead of crashing Mayan simply... ignores the entire local.py file?

I was able to definitively prove this - add "import ldap" to the local.py, and static files aren't served. Remove it(or install the package), and they are.

Anyway, I hope this helps someone. This is very much unlike any other Python application I've ever seen when it comes to that behavior.

Thanks,

-Rob


On Thursday, August 24, 2017 at 11:57:50 AM UTC-7, Roberto Rosario wrote:
Hi,

I was not able to reproduce your issue. Error 500 for static media means the DEBUG=True statement is not being picked up by Django. Make sure you are editing the local.py inside the virtualenv and not in the root installation of Python (your path has an initial '/'). Unlikely but just in case.

Also make sure there are no other hanged processes using:

ps x a| grep 'mayan'

Sometimes previous runserver commands can remain in a Linux zombie process.

Finally, try this exactly as typed and check static media to discard any library difference with the OS.

cd /tmp
virtualenv venv
source venv/bin/activate
pip install mayan-edms==2.6.4
mayan-edms.py initialsetup
echo "DEBUG=True" >> venv/lib/python2.7/site-packages/mayan/settings/local.py
mayan-edms.py runserver

Browse to localhost:8000

Check static files directly: <a href="http://127.0.0.1:8000/static/appearance/css/base.css" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;">http://127.0.0.1:8000/static/appearance/css/base.css

Let me know how it goes.

On Tuesday, August 22, 2017 at 10:55:03 AM UTC-4, MacRobb Simpson wrote:
Hello,

I'm running into a little bit of trouble getting static files served using the 'mayan-edms.py runserver' command I used in earlier versions.

My goal is to basically have it working like I did in 2.1 - I simply run the 'runserver' command, and I have a development environment running; each load of a file is logged to the console and everything is great!

Currently, what I have is it serving the main content, but no static files - all static requests return 500 errors.

My setup is as follows:
1. Debian x64 system
2. Mayan is installed in a virtualenv using pip ("pip install mayan-edms").
3. I've created a 'local.py' file in '/lib/python2.7/site-packages/mayan/settings/' and added 'DEBUG=True', as shown here: <a href="https://gitlab.com/mayan-edms/mayan-edms/issues/368" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms/issues/368
4. I've verified that my local.py file is being picked up - I've deleted all the .pyc files in that directory, and when I run the runserver command, it creates 'local.pyc' again.

When I run it using the runserver command, I get no errors, and no logging of anything in the console, not even the browser request that brings me to the login screen(which obviously returns 200 in the browser).
(It *is* being loaded from this instance of Mayan, however - killing the runserver command, the page doesn't load at all, as expected).

Any ideas on how to make debug mode work?

Thanks,

-Rob


--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2058] Re: Trouble with debug/runserver on 2.6.4

rosarior
Administrator
The behavior is caused by this: https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/settings/__init__.py

It is meant to allow Mayan to continue executing even if there is no local.py (such as when running the createsettings or initialsetup commands). Raising an error would not allow the normal flow to happen. Python groups all import exception under ImportException regardless of what cause a module to import. The best I've come up with is to examine the text of the exception to try to find out why it was raised (example: https://gitlab.com/mayan-edms/mayan-edms-docker/blob/master/etc/mayan/settings/__init__.py#L49). This is a crude solution, but Python doesn't offer anything else that I know of. Best compromise would be to display a warning and keep the execution going. Thoughts?

On Thursday, August 31, 2017 at 9:11:30 AM UTC-4, MacRobb Simpson wrote:
First off, sorry for taking so long for a response.

Doing exactly that... worked.
Upon troubleshooting, the only thing different between this 'clean' copy and mine was the local.py config file, where I had a few extra settings - Mysql DB setup for the DB, ldap for authentication.
What I eventually found is that, if you don't have the Mysql or ldap packages installed vin your virtualenv, instead of crashing Mayan simply... ignores the entire local.py file?

I was able to definitively prove this - add "import ldap" to the local.py, and static files aren't served. Remove it(or install the package), and they are.

Anyway, I hope this helps someone. This is very much unlike any other Python application I've ever seen when it comes to that behavior.

Thanks,

-Rob


On Thursday, August 24, 2017 at 11:57:50 AM UTC-7, Roberto Rosario wrote:
Hi,

I was not able to reproduce your issue. Error 500 for static media means the DEBUG=True statement is not being picked up by Django. Make sure you are editing the local.py inside the virtualenv and not in the root installation of Python (your path has an initial '/'). Unlikely but just in case.

Also make sure there are no other hanged processes using:

ps x a| grep 'mayan'

Sometimes previous runserver commands can remain in a Linux zombie process.

Finally, try this exactly as typed and check static media to discard any library difference with the OS.

cd /tmp
virtualenv venv
source venv/bin/activate
pip install mayan-edms==2.6.4
mayan-edms.py initialsetup
echo "DEBUG=True" >> venv/lib/python2.7/site-packages/mayan/settings/local.py
mayan-edms.py runserver

Browse to localhost:8000

Check static files directly: <a href="http://127.0.0.1:8000/static/appearance/css/base.css" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;">http://127.0.0.1:8000/static/appearance/css/base.css

Let me know how it goes.

On Tuesday, August 22, 2017 at 10:55:03 AM UTC-4, MacRobb Simpson wrote:
Hello,

I'm running into a little bit of trouble getting static files served using the 'mayan-edms.py runserver' command I used in earlier versions.

My goal is to basically have it working like I did in 2.1 - I simply run the 'runserver' command, and I have a development environment running; each load of a file is logged to the console and everything is great!

Currently, what I have is it serving the main content, but no static files - all static requests return 500 errors.

My setup is as follows:
1. Debian x64 system
2. Mayan is installed in a virtualenv using pip ("pip install mayan-edms").
3. I've created a 'local.py' file in '/lib/python2.7/site-packages/mayan/settings/' and added 'DEBUG=True', as shown here: <a href="https://gitlab.com/mayan-edms/mayan-edms/issues/368" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms/issues/368
4. I've verified that my local.py file is being picked up - I've deleted all the .pyc files in that directory, and when I run the runserver command, it creates 'local.pyc' again.

When I run it using the runserver command, I get no errors, and no logging of anything in the console, not even the browser request that brings me to the login screen(which obviously returns 200 in the browser).
(It *is* being loaded from this instance of Mayan, however - killing the runserver command, the page doesn't load at all, as expected).

Any ideas on how to make debug mode work?

Thanks,

-Rob


--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[Mayan EDMS: 2059] Re: Trouble with debug/runserver on 2.6.4

rosarior
Administrator
Give this a try without the ldap or MySQL libraries:

from __future__ import absolute_import

from django.utils.encoding import force_text

try:
    from .local import *  # NOQA
except ImportError as exception:
    # Python 2 and 3 exception messages
    if force_text(exception) != 'No module named local' and force_text(exception) != 'No module named \'mayan.settings.local\'':
        raise
    from .base import *  # NOQA

Ported from here: https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/apps/smart_settings/classes.py#L27


On Thursday, August 31, 2017 at 4:20:39 PM UTC-4, Roberto Rosario wrote:
The behavior is caused by this: <a href="https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/settings/__init__.py" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fblob%2Fmaster%2Fmayan%2Fsettings%2F__init__.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAq0uOe3AF_0RwmZI65FON28Ek7w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fblob%2Fmaster%2Fmayan%2Fsettings%2F__init__.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAq0uOe3AF_0RwmZI65FON28Ek7w&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/settings/__init__.py

It is meant to allow Mayan to continue executing even if there is no local.py (such as when running the createsettings or initialsetup commands). Raising an error would not allow the normal flow to happen. Python groups all import exception under ImportException regardless of what cause a module to import. The best I've come up with is to examine the text of the exception to try to find out why it was raised (example: <a href="https://gitlab.com/mayan-edms/mayan-edms-docker/blob/master/etc/mayan/settings/__init__.py#L49" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms-docker%2Fblob%2Fmaster%2Fetc%2Fmayan%2Fsettings%2F__init__.py%23L49\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNECNnONrPxddg97zC0GcNSdXzsWig&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms-docker%2Fblob%2Fmaster%2Fetc%2Fmayan%2Fsettings%2F__init__.py%23L49\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNECNnONrPxddg97zC0GcNSdXzsWig&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms-docker/blob/master/etc/mayan/settings/__init__.py#L49). This is a crude solution, but Python doesn't offer anything else that I know of. Best compromise would be to display a warning and keep the execution going. Thoughts?

On Thursday, August 31, 2017 at 9:11:30 AM UTC-4, MacRobb Simpson wrote:
First off, sorry for taking so long for a response.

Doing exactly that... worked.
Upon troubleshooting, the only thing different between this 'clean' copy and mine was the local.py config file, where I had a few extra settings - Mysql DB setup for the DB, ldap for authentication.
What I eventually found is that, if you don't have the Mysql or ldap packages installed vin your virtualenv, instead of crashing Mayan simply... ignores the entire local.py file?

I was able to definitively prove this - add "import ldap" to the local.py, and static files aren't served. Remove it(or install the package), and they are.

Anyway, I hope this helps someone. This is very much unlike any other Python application I've ever seen when it comes to that behavior.

Thanks,

-Rob


On Thursday, August 24, 2017 at 11:57:50 AM UTC-7, Roberto Rosario wrote:
Hi,

I was not able to reproduce your issue. Error 500 for static media means the DEBUG=True statement is not being picked up by Django. Make sure you are editing the local.py inside the virtualenv and not in the root installation of Python (your path has an initial '/'). Unlikely but just in case.

Also make sure there are no other hanged processes using:

ps x a| grep 'mayan'

Sometimes previous runserver commands can remain in a Linux zombie process.

Finally, try this exactly as typed and check static media to discard any library difference with the OS.

cd /tmp
virtualenv venv
source venv/bin/activate
pip install mayan-edms==2.6.4
mayan-edms.py initialsetup
echo "DEBUG=True" >> venv/lib/python2.7/site-packages/mayan/settings/local.py
mayan-edms.py runserver

Browse to localhost:8000

Check static files directly: <a href="http://127.0.0.1:8000/static/appearance/css/base.css" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F127.0.0.1%3A8000%2Fstatic%2Fappearance%2Fcss%2Fbase.css\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGnNo8qdYvkVsSGTQKohCjqlyPRpQ&#39;;return true;">http://127.0.0.1:8000/static/appearance/css/base.css

Let me know how it goes.

On Tuesday, August 22, 2017 at 10:55:03 AM UTC-4, MacRobb Simpson wrote:
Hello,

I'm running into a little bit of trouble getting static files served using the 'mayan-edms.py runserver' command I used in earlier versions.

My goal is to basically have it working like I did in 2.1 - I simply run the 'runserver' command, and I have a development environment running; each load of a file is logged to the console and everything is great!

Currently, what I have is it serving the main content, but no static files - all static requests return 500 errors.

My setup is as follows:
1. Debian x64 system
2. Mayan is installed in a virtualenv using pip ("pip install mayan-edms").
3. I've created a 'local.py' file in '/lib/python2.7/site-packages/mayan/settings/' and added 'DEBUG=True', as shown here: <a href="https://gitlab.com/mayan-edms/mayan-edms/issues/368" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitlab.com%2Fmayan-edms%2Fmayan-edms%2Fissues%2F368\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEFRvyH-XoSwHYvYfg-NGFLtsFxtQ&#39;;return true;">https://gitlab.com/mayan-edms/mayan-edms/issues/368
4. I've verified that my local.py file is being picked up - I've deleted all the .pyc files in that directory, and when I run the runserver command, it creates 'local.pyc' again.

When I run it using the runserver command, I get no errors, and no logging of anything in the console, not even the browser request that brings me to the login screen(which obviously returns 200 in the browser).
(It *is* being loaded from this instance of Mayan, however - killing the runserver command, the page doesn't load at all, as expected).

Any ideas on how to make debug mode work?

Thanks,

-Rob


--

---
You received this message because you are subscribed to the Google Groups "Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.