Streamlit登录认证UI库使用教程

Streamlit登录认证UI库使用教程

streamlit_login_auth_uiIt lets you connect your streamlit application to a pre-built and secure Login/ Sign-Up page.项目地址:https://gitcode.com/gh_mirrors/st/streamlit_login_auth_ui

目录结构及介绍

streamlit_login_auth_ui/
├── app.py
├── LICENSE
├── README.md
├── requirements.txt
├── setup.py
└── tests/
    └── test_app.py
  • app.py: 项目的启动文件,包含主要的应用程序逻辑。
  • LICENSE: 项目的许可证文件,本项目采用MIT许可证。
  • README.md: 项目的说明文档,包含项目的基本信息和使用指南。
  • requirements.txt: 项目依赖的Python库列表。
  • setup.py: 项目的安装脚本。
  • tests/: 包含项目的测试文件。
    • test_app.py: 应用程序的测试文件。

项目的启动文件介绍

app.py 是项目的启动文件,主要负责初始化和运行Streamlit应用程序。以下是 app.py 的关键部分代码:

import streamlit as st
from streamlit_login_auth_ui.widgets import __login__

__login__obj = __login__(
    auth_token="courier_auth_token",
    company_name="Shims",
    width=200,
    height=250,
    logout_button_name='Logout',
    hide_menu_bool=False,
    hide_footer_bool=False,
    lottie_url='https://assets2.lottiefiles.com/packages/lf20_jcikwtux.json'
)

LOGGED_IN = __login__obj.build_login_ui()
username = __login__obj.get_username()

if LOGGED_IN:
    st.markdown("Your Streamlit Application Begins here ")
    st.markdown(st.session_state)
    st.write(username)
  • __login__ 类用于处理用户登录和认证。
  • build_login_ui() 方法用于构建登录界面。
  • get_username() 方法用于获取当前登录用户的用户名。

项目的配置文件介绍

requirements.txt 文件列出了项目运行所需的Python库。以下是 requirements.txt 的内容示例:

streamlit==1.3.1
streamlit-login-auth-ui==1.0.0
  • streamlit: Streamlit框架,用于创建Web应用程序。
  • streamlit-login-auth-ui: 本项目的登录认证UI库。

setup.py 文件用于项目的安装和分发。以下是 setup.py 的关键部分代码:

from setuptools import setup, find_packages

setup(
    name='streamlit_login_auth_ui',
    version='1.0.0',
    packages=find_packages(),
    install_requires=[
        'streamlit==1.3.1',
    ],
    author='GauriSP10',
    author_email='gauri@example.com',
    description='A Streamlit login authentication UI library',
    long_description=open('README.md').read(),
    long_description_content_type='text/markdown',
    url='https://github.com/GauriSP10/streamlit_login_auth_ui',
    classifiers=[
        'Programming Language :: Python :: 3',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
    ],
)
  • name: 项目的名称。
  • version: 项目的版本号。
  • packages: 需要包含的包。
  • install_requires: 项目依赖的Python库。
  • author: 项目的作者。
  • author_email: 作者的电子邮件地址。
  • description: 项目的简短描述。
  • long_description: 项目的详细描述,通常从 README.md 文件读取。
  • long_description_content_type: 详细描述的内容类型。
  • url: 项目的GitHub仓库地址。
  • classifiers: 项目的分类信息。

streamlit_login_auth_uiIt lets you connect your streamlit application to a pre-built and secure Login/ Sign-Up page.项目地址:https://gitcode.com/gh_mirrors/st/streamlit_login_auth_ui

  • 7
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

包幸慈Ferris

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值