django-sspanel 面板安装教程(小白版)

说明

    本文以Centos7为例,机器1024M内存(512M亦可,价格低至1.99美元/月),在Cloudclone购买,购买地址(本地址才有优惠价):1024M版本, 512M版本

安装宝塔和LNMP

    yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh

    等程序运行完毕,出现如下图样时,访问宝塔页面。

    进入宝塔页面建议在面板设置里修改账户密码,会弹出一个提示框,按照如图所示修改并确定

    接下来将是长达半小时的安装过程,耐心等待。建议为了安全在等待过程中到面板设置里修改账户密码。
    如果现在你有一个域名,就赶紧解析到ip上吧。下面所有的代码中域名为django-sspanel-sample.ml,注意替换

安装pyenv

    首先安装git

    yum install git -y

    然后安装pyenv

    curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
    

    复制你脚本运行完提示添加的语句

    我的是这个,注意替换

    export PATH="/root/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    

    修改自己的~/.bash_profile

    nano ~/.bash_profile
    

    如果如果提示错误,可能是你没安装nano

    yum install -y nano
    

    把你刚才复制的内容添加在末尾,按住Ctrl+X键,接着按Y键,再接着回车就能保存了。
    使自己的profile生效

    source ~/.bash_profile
    

    如果nano ~/.bash_profile没有任何内容,则吧~/.bash_profile换成 ~/.bashrc

安装Python3

    把下列命令粘贴到命令行一起运行

    yum -y install gcc
    yum -y install make
    yum -y install zlib zlib-devel
    yum -y install readline readline-devel readline-static
    yum -y install openssl openssl-devel openssl-static
    yum -y install sqlite-devel
    yum -y install bzip2-devel bzip2-libs
    yum install -y python-devel 
    yum install -y python3-devel

    如果他说No package python3-devel available. Error: Nothing to do 则运行下列命令

    yum search python | grep devel
    

    找到类似这样的包python34-devel.x86_64,反正形式类似,版本不一定是python34

    yum -y install python34-devel.x86_64

    这一步需要一定时间

    pyenv install 3.6.3

    安装虚拟运行环境

    pyenv virtualenv 3.6.3 venv-sspanel
    

安装django-sspanel

    在宝塔新建一个网站,注意新建数据库sspanel并修改密码

    运行下列命令(注意替换)

    cd /www/wwwroot/django-sspanel-sample.ml
    git clone -b master https://github.com/Ehco1996/django-sspanel.git
    cd django-sspanel
    pyenv local venv-sspanel
    pip install -r requirements.txt 
    

    将下列添加如伪静态规则(注意替换)

    location /media  
        {        
            alias /www/wwwroot/django-sspanel-sample.ml/django-sspanel/media;  # 媒体文件地址
        }    
    location /static
        {    
            alias /www/wwwroot/django-sspanel-sample.ml/django-sspanel/static; #静态文件地址,js/css
            expires  12h;
        }    
    location /
        {    
            include uwsgi_params;        
            uwsgi_pass 127.0.0.1:8080;
        }

    在配置文件中在/和;之间添加django-sspanel

配置django-sspanel

    修改配置,注意保存方式为按住Ctrl+X键,接着按Y键,再接着回车。

    nano django-sspanel/simple_setting_product.py

    和v3面板类似,修改数据库对接信息,这里需要修改的是数据库用户和密码。前期如果没有设置好邮箱,可以把是否开启邮件功能改为USE_SMTP = False,另外没有支付接口的话,把是否启用支付宝系统 调成 USE_ALIPAY = False
    每一项都有注释,按需修改

配置uwsgi

    nano /www/wwwroot/django-sspanel-sample.ml/django-sspanel/uwsgi.ini

    然后修改一波(注意替换)

    [uwsgi]
    
    # variables
    projectname = django-sspanel # 项目名字
    projectdomain = 'django-sspanel-sample.ml' # 项目域名
    base = /www/wwwroot/django-sspanel-sample.ml/django-sspanel
    
    # config
    chdir= /www/wwwroot/django-sspanel-sample.ml/django-sspanel/
    plungins = python
    socket = 127.0.0.1:8080  # 运行端口
    module = django-sspanel.wsgi:application
    pidfile = /tmp/django-sspanel.pid # pid文件
    master = True
    vacuum = True
    

同步数据库

    一个一个运行

    python manage.py migrate
    python manage.py runserver(Ctrl+C退出)
    python manage.py crontab add
    

创建管理员账号

    看提示

    python manage.py createsuperuser

    运行程序

    uwsgi uwsgi.ini
    

    运行后可以关闭终端
    注意:所有在django-sspanel/simple_setting_product.py内更改的内容需要重启才能生效,命令为killall -9 uwsgi

最后一步

    至此,我们前端的教程到此结束。访问我们的网站后台:django-sspanel-sample.ml/admin,应该可以登陆了。登陆后还需要绑定管理员账户。
    添加一个ss账户,user切换为root,其他按需修改即可。

演示站点

2 对 “django-sspanel 面板前端简明安装教程”的想法;

  1. 运行[root@iZt4n9uvvifcdnn2nn67mfZ ~]# yum install -y python3-devel
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    No package python3-devel available.
    Error: Nothing to do
    [root@iZt4n9uvvifcdnn2nn67mfZ ~]#

    也运行了
    dbus-python-devel.i686 : Libraries and headers for dbus-python
    dbus-python-devel.x86_64 : Libraries and headers for dbus-python
    gstreamer-python-devel.i686 : Headers for developing programs that will use
    gstreamer-python-devel.x86_64 : Headers for developing programs that will use
    nautilus-python-devel.x86_64 : Python bindings for Nautilus
    nemo-python-devel.x86_64 : Python bindings for Nemo
    python-caja-devel.x86_64 : Python bindings for Caja
    python-cherrypy.noarch : Pythonic, object-oriented web development framework
    python-cherrypy2.noarch : Pythonic, object-oriented web development framework
    python-devel.x86_64 : The libraries and header files needed for Python
    : development
    python-greenlet-devel.x86_64 : C development headers for python-greenlet
    python-pillow-devel.i686 : Development files for python-pillow
    python-pillow-devel.x86_64 : Development files for python-pillow
    python-pyside-devel.x86_64 : Development files for python-pyside
    python-tools.x86_64 : A collection of development tools included with Python
    python-werkzeug.noarch : The Swiss Army knife of Python web development
    python2-behave.noarch : Tools for the behavior-driven development, Python style
    : developed at OSRF
    python34-cairo-devel.x86_64 : Libraries and headers for python34-cairo
    python34-devel.x86_64 : Libraries and header files needed for Python 3
    : development
    python34-gobject-devel.x86_64 : Development files for embedding Python 3.4
    python34-greenlet-devel.x86_64 : C development headers for python34-greenlet
    python36-devel.x86_64 : Libraries and header files needed for Python development
    wxPython-devel.x86_64 : Development files for wxPython add-on modules
    xapian-bindings-python.x86_64 : Files needed for developing Python scripts which
    TurboGears.noarch : Back-to-front web development in Python
    gnome-python2-devel.x86_64 : Development files for building add-on libraries
    hawkey-devel.i686 : A Library providing simplified C and Python API to libsolv
    hawkey-devel.x86_64 : A Library providing simplified C and Python API to libsolv
    kobo.noarch : Python modules for tools development
    pygtksourceview-devel.x86_64 : Development files for using pygtksourceview in
    pyldb-devel.i686 : Development files for the Python bindings for the LDB library
    pyldb-devel.x86_64 : Development files for the Python bindings for the LDB
    python-igraph-devel.x86_64 : Development files for igraph
    python-pycxx-devel.noarch : PyCXX header and source files
    python-strainer.noarch : Tools to allow developers to cleanup web serialization
    python-zc-buildout.noarch : System for managing development buildouts
    python2-clint.noarch : A set of awesome tools for developing commandline
    qscintilla-python-devel.noarch : Development files for QScintilla PyQt4 bindings
    sip-devel.i686 : Files needed to generate Python bindings for any C++ class
    sip-devel.x86_64 : Files needed to generate Python bindings for any C++ class

    也安装了但是还是有问题

发表评论

电子邮件地址不会被公开。 必填项已用*标注