No Access to the dashboard once again

173 views
Skip to first unread message

Weemo

unread,
Jul 12, 2022, 6:13:21 PM7/12/22
to py4web
This is really weird. I am beginning to think that after I clone my virtual machine, where the py4web app sits, I lose the ability to access the dashboard. As if my password gets screwed. It does not accept it.

Anyone has experienced the same? I try to reset the password but still does not work.

Any other way to create users?


Thanks

CarlosDB

unread,
Jul 13, 2022, 6:06:01 AM7/13/22
to py4web

How exactly did you intend to reset the password?
Do you have the password.txt file?

If the password.txt file does not exist or py4web does not find it, you should see a message when starting py4web “You have not set a dashboard password.”


 /#######  /##     /##/##   /## /##      /## /######## /####### 
| ##__  ##|  ##   /##/ ##  | ##| ##  /# | ##| ##_____/| ##__  ##
| ##  \ ## \  ## /##/| ##  | ##| ## /###| ##| ##      | ##  \ ##
| #######/  \  ####/ | ########| ##/## ## ##| #####   | ####### 
| ##____/    \  ##/  |_____  ##| ####_  ####| ##__/   | ##__  ##
| ##          | ##         | ##| ###/ \  ###| ##      | ##  \ ##
| ##          | ##         | ##| ##/   \  ##| ########| #######/
|__/          |__/         |__/|__/     \__/|________/|_______/
Is still experimental...

Py4web: 1.20220615.1 on Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0]

You have not set a dashboard password. Run "/home/carlos/p1/py4web/py4web.py set_password" to do so.
[ ] loading _documentation ...
[X] loaded _documentation       
[ ] loading _dashboard ...
[X] loaded _dashboard       
[ ] loading _scaffold ...
[X] loaded _scaffold

Weemo

unread,
Jul 13, 2022, 12:17:58 PM7/13/22
to py4web
Yes I set up a password. I used py4web set_password. I can see the password.txt. It used to work but not anymore

CarlosDB

unread,
Jul 13, 2022, 3:31:59 PM7/13/22
to py4web
When I have had problems with the password it has always been because py4web could not find password.txt

py4web displayed the message "You have not set a dashboard password."

py4web looks for the password.txt file in the current working directory.

do you have any message from py4web about the password?
Won't you have more than one password.txt file in different directories?

Weemo

unread,
Jul 13, 2022, 4:42:42 PM7/13/22
to py4web
Thanks Carlos. I cant seem to find another password.txt. Any way to reset it?

Jim Steil

unread,
Jul 13, 2022, 5:00:36 PM7/13/22
to py4web
What command are you using to start py4web?

What directory do you run it from?

For example, my directory structure looks like this:

/home/jim/dev/py4web/

apps directory is

/home/jim/dev/py4web/apps

I cd to /home/jim/dev/py4web and run

python3 py4web.py set_password

password.txt is then created in /home/jim/dev/py4web

I can then run (from the same directory)

python3 py4web.py run apps

I can then login to the dashboard

Is that the same structure that you're using?

-Jim

Weemo

unread,
Jul 13, 2022, 5:14:33 PM7/13/22
to py4web
A little background. I am on Ubuntu server py4web under nginx. Directory structure is:
  • I have it under /home/www-data/py4web/apps
  • And I have py4web running as a Service using systemd
  • I can open the dashboard but not log into.
At some point I could log into the dashboard. The only different significant change is that I started cloning the virtual guest where py4web resides.

Weemo

unread,
Jul 13, 2022, 5:16:45 PM7/13/22
to py4web
on:

/etc/nginx/sites-enabled/py4web I have:

server {
        listen          80;
        server_name     $hostname;
        location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
            alias /home/www-data/py4web/apps/$1/static/$2;
            expires max;
        }
        location / {
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   Host $http_host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-Host $http_host;
            proxy_redirect off;
            proxy_pass      http://127.0.0.1:8000;
        }
}
server {
        listen 443 default_server ssl;
        server_name     $hostname;
        ssl_certificate         /etc/nginx/ssl/py4web.crt;
        ssl_certificate_key     /etc/nginx/ssl/py4web.key;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SH>
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        keepalive_timeout    70;
        location / {
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   Host $http_host;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   X-Forwarded-Host $http_host;
            proxy_redirect off;
            proxy_pass      http://127.0.0.1:8000;
        }
        location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
            alias /home/www-data/py4web/apps/$1/static/$2;
            expires max;
        }
}

Jim Steil

unread,
Jul 13, 2022, 5:22:25 PM7/13/22
to py4web
What does your py4web service file look like?

-Jim

Weemo

unread,
Jul 13, 2022, 5:42:59 PM7/13/22
to py4web
[Unit]
Description=py4webstarter

[Service]
Type=simple
ExecStart=/bin/bash /home/www-data/py4web/py4start.sh



[Install]
WantedBy=multi-user.target



then py4start.sh:

#!/bin/bash
py4web run /home/www-data/py4web/apps


Jim Steil

unread,
Jul 13, 2022, 5:48:58 PM7/13/22
to py4web
I wonder if the problem is that it can't find the password file.

There are a few ways I'd go about debugging this.

1. add a WorkingDirectory directive to the py4web .service file.

2. in py4start.sh add a cd /home/www-data/py4web

3. add the -p switch to the py4web run /home/www-data/py4web/apps command to explicitly tell py4web where to find the password file.
if the password file is in /home/www-data/py4web, then use this:

py4web run -p /home/www-data/py4web /home/www-data/py4web/apps

Can you try some of those and see what happens?

-Jim

Weemo

unread,
Jul 13, 2022, 6:19:59 PM7/13/22
to py4web
That was it. 

worked by adding the whole path to password.txt followed by the apps directory

py4web run -p /home/www-data/py4web/password.txt /home/www-data/py4web/apps



thanks Jim!!

Jim Steil

unread,
Jul 13, 2022, 6:45:13 PM7/13/22
to Weemo, py4web
Great news, glad you figured it out.



--
You received this message because you are subscribed to a topic in the Google Groups "py4web" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/py4web/Rr4unC7m-nw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/43511f11-d12f-472a-b695-b8922c6137e0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages