I unable to connect with pgdata | domain redirect on installation page #4277

Closed
opened 2026-02-21 18:05:31 -05:00 by yindo · 2 comments
Owner

Originally created by @Rameshkumardas on GitHub (Jun 26, 2024).

#######

Originally created by @Rameshkumardas on GitHub (Jun 26, 2024). #######
yindo added the 🐞 bug label 2026-02-21 18:05:31 -05:00
yindo closed this issue 2026-02-21 18:05:31 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 26, 2024):

To resolve the issue where your self-hosted Dify instance redirects to the installation page instead of the login page, despite having pgdata set up, you need to ensure that the setup status is correctly recorded in the database. Here are the steps to troubleshoot and fix this:

  1. Check the Setup Status in the Database:
    Ensure that the setup status is correctly recorded in the database. The get_setup_status function checks if the setup has been completed by querying the DifySetup model.

    def get_setup_status():
        if current_app.config['EDITION'] == 'SELF_HOSTED':
            return DifySetup.query.first()
        else:
            return True
    

    If DifySetup.query.first() returns None, it means the setup is not marked as completed.

  2. Ensure the Setup Function is Called:
    Make sure that the setup function is called and the DifySetup instance is correctly added to the database. You might need to add db.session.commit() after adding the DifySetup instance to ensure the changes are committed.

    def setup():
        dify_setup = DifySetup(
            version=current_app.config['CURRENT_VERSION']
        )
        db.session.add(dify_setup)
        db.session.commit()  # Ensure the changes are committed
    
  3. Verify the post Method of SetupApi:
    Ensure that the post method of SetupApi is called successfully and the setup process completes without errors. This should mark the setup as completed and prevent the redirection to the installation page.

By following these steps, you should be able to resolve the issue and have your Dify instance redirect to the login page instead of the installation page [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 26, 2024): <!-- Answer --> To resolve the issue where your self-hosted Dify instance redirects to the installation page instead of the login page, despite having `pgdata` set up, you need to ensure that the setup status is correctly recorded in the database. Here are the steps to troubleshoot and fix this: 1. **Check the Setup Status in the Database**: Ensure that the setup status is correctly recorded in the database. The `get_setup_status` function checks if the setup has been completed by querying the `DifySetup` model. ```python def get_setup_status(): if current_app.config['EDITION'] == 'SELF_HOSTED': return DifySetup.query.first() else: return True ``` If `DifySetup.query.first()` returns `None`, it means the setup is not marked as completed. 2. **Ensure the Setup Function is Called**: Make sure that the `setup` function is called and the `DifySetup` instance is correctly added to the database. You might need to add `db.session.commit()` after adding the `DifySetup` instance to ensure the changes are committed. ```python def setup(): dify_setup = DifySetup( version=current_app.config['CURRENT_VERSION'] ) db.session.add(dify_setup) db.session.commit() # Ensure the changes are committed ``` 3. **Verify the `post` Method of `SetupApi`**: Ensure that the `post` method of `SetupApi` is called successfully and the setup process completes without errors. This should mark the setup as completed and prevent the redirection to the installation page. By following these steps, you should be able to resolve the issue and have your Dify instance redirect to the login page instead of the installation page <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/controllers/console/setup.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jun 26, 2024):

Close due to violating the checklist.

@crazywoola commented on GitHub (Jun 26, 2024): Close due to violating the checklist.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4277