• manjaro+apache+django+mod_wsgi 安装


    感叹一下:https://wiki.archlinux.org太强大了

    Manjaro下自带了python

    主要需要安装apache+mod_wsgi

    arch linux系列的apache与ubuntu系列的目录有些不同,比如配置文件为/etc/httpd/conf/httpd.conf

    https://wiki.archlinux.org/index.php/Apache_HTTP_Server

    sudo pacman -S apache

    修改/etc/httpd/conf/httpd.conf

    <VirtualHost *:80>
      
    ServerName localhost:80
    DocumentRoot /home/user/myproject
    
    <Directory /home/user/myproject>
            <Files wsgi.py>
                    Require all granted
            </Files>
    </Directory>
    
    WSGIScriptAlias / /home/user/myproject/myproject/wsgi.py
    
    </VirtualHost>
    WSGIPythonPath /home/user/myproject/
    WSGIPythonHome /usr/

    可以参考之前的文章:

    https://www.cnblogs.com/yanghao2008/articles/13047386.html

    参考一下网页:

     https://wiki.archlinux.org/index.php/Apache_HTTP_Server/mod_wsgi

    安装编译依赖

    sudo pacman -S gcc
    sudo pacman -S make

    安装mod_wsgi

    yay -S mod_wsgi

    安装成功后,在/etc/httpd/conf/httpd.conf中加入

    LoadModule wsgi_module modules/mod_wsgi.so

    查看错误文件:

    vim /var/log/httpd/error_log

    查看运行状态

    systemctl -l status httpd.service

    启动apache

    systemctl restart httpd

    出现错误:/home/user/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/user/' is executable

    https://blog.csdn.net/leafe920/article/details/8127088

    chmod -R 755 /user

    出错: ModuleNotFoundError: No module named 'django'

    明明pip install django已经装上了,但是还是出错。

    https://stackoverflow.com/questions/46413676/modulenotfounderror-no-module-named-django

    紧要内容如下:

    This might be answered many times, but recently I upgraded my ubuntu 18.04 to 19.10, and without changing any other thing, my running django server stopped running with this error: ModuleNotFoundError: No module named 'django'. I repeated the same install, python3 -m pip install django and it didn't help. Finally somebody else told me to use

    sudo python3 -m pip install django

    because I run the server with sudo python3 manage.py runserver 0.0.0.0:80, which actually worked for me.

     

  • 相关阅读:
    [转]责任链模式
    spring中常见注解描述
    [转]外观模式
    [转]策略模式
    分布式事务实践
    SpringBoot入门
    服务器性能调优
    kvm qemu内幕介绍
    xen 保存快照的实现之 —— device model 状态保存
    xen hypercall 的应用层实现
  • 原文地址:https://www.cnblogs.com/yanghao2008/p/13160912.html
Copyright © 2020-2023  润新知