• To successfully run a Streamlit application in Python using an XAMPP MySQL database, we must install the necessary dependencies/software tools and set up our environment correctly.
  • The detailed step-by-step process is as follows : –
    • Download & Install Python [ from Python.org ].
    • Download & install XAMPP [ from Apache Friends ].
    • Download & install Pycharm IDE/Visual Studio Code/or use the Command Prompt as administrator.
    • Run the following command on the Pycharm IDE terminal/VS Code terminal/Command Prompt/PowerShell or Anaconda Prompt:-

pip install streamlit sqlalchemy pymysql (press enter)

OR

pip install sqlalchemy pymysql streamlit (press enter)

The above command
        • installs streamlit → For creating the web application.
        • installs sqlalchemy → For database connectivity.
        • installs pymysql → To connect MySQL with Python.
    • Create UI pages (such as user_registration.py/employee.py) with connectivity codes using the VS code/Pycharm IDE, etc.
    • Open Xampp Control Panel – Now create a Database and Tables in MySql database by opening phpMyAdmin using http://localhost/phpmyadmin/ in your browser.

      • Execute this SQL in phpMyAdmin > SQL
        • CREATE TABLE user_registration (
              id INT AUTO_INCREMENT PRIMARY KEY,
              name5 VARCHAR(255),
              age5 INT,
              email5 VARCHAR(255) UNIQUE,
              gen5 ENUM(‘Male’, ‘Female’, ‘Transgender’),
              pass5 VARCHAR(255),
              addr5 TEXT,
              dob5 DATE,
              nat5 VARCHAR(50),
              matric5 BOOLEAN,
              inter5 BOOLEAN,
              grad5 BOOLEAN,
              rem5 TEXT
          ); 
    • Finally, run the Streamlit App( such as user_registration.py/employee.py, etc) by typing the command [ streamlit run employee.py (press enter) ] at the VS Code terminal/Pycharm IDE terminal/Command Prompt. This will open your app in the browser at :- http://localhost:8501.

Loading

Categories: Streamlit

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.