用于速度友好活动的匹配软件。

speed-friending-matcher的Python项目详细描述


快速交友和约会活动的匹配软件

Build StatusLicense: MITCode style: black

此应用程序旨在使您的生活作为快速交友或快速约会活动的组织者更容易。我为一个local speed friending event in Vienna, Austria创建了这个软件,以将价值回馈给活动组织者。对我来说,这个项目还可以作为软件工程最佳实践的游乐场。应用程序是在一个敏捷的、测试驱动的开发过程中实现的,应用了迄今为止我所知道的所有开发最佳实践。

安装应用程序

要安装实时编码环境,请运行:

python setup.py install

或通过PIP安装

pip install speed-friending-matcher

如何使用

从命令行运行速度友好匹配程序:

usage: speed_friending_matcher [-h] -i INPUT -o OUTPUT [-m MATCHMAKER] [-s]

Matchmaking application for speed friending events

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input plugin and parameters e.g. csv:somefile.csv
  -o OUTPUT, --output OUTPUT
                        Output plugins and parameters e.g. todo:mytodo.txt
  -m MATCHMAKER, --matchmaker MATCHMAKER
                        Matchmaker, simple or clique
  -s, --server          Starts a local webserver with a web GUI.

例如:

speed_friending_matcher -i csv:example/sample.csv -o todo:test.txt

导入程序插件

  • csv:<;filename>;.csv:导入包含分区数据的csv文件

导出器插件

[]表示可选

  • TOdo-导出TOdo文件
todo:<filename>.txt:[<template_filename>.txt]
  • onexlsx-导出包含匹配信息的单个excel工作表
onexlsx:<filename>.xlsx
  • clique-导出包含所有已找到的团的文件,以便与团媒人一起使用
clique:<filename>.txt:[<header_filename>.txt]:[<template_filename.txt]
  • graph-导出匹配图的图形表示,支持GraphViz支持的任何导出格式
graph:<filename>.<png, dot, ...>

媒人

  • simple:简单我喜欢你,你喜欢我做媒
  • clique:查找彼此喜欢的人的集团

在服务器上运行

应用程序可以在服务器模式下使用可选的命令行参数-s启动。 但是,请注意,这将启动不推荐使用的开发服务器 用于生产。

如果要在Web服务器上运行应用程序,请参阅 WSGI Guide for Flask.或 使用gunicorn

例如:

pip3 install gunicorn --user
gunicorn -w 4 wsgi:application

使用apache或其他web服务器.htaccess转发端口。

详细说明

以下说明是在具有根访问权限的服务器上测试的。

如果要在生产环境中运行这些步骤,请确保已准备好备份。任何损坏或损失我概不负责。

如果你有一个网站管理员,让你的网站管理员做这项工作。

确保安装了python和pip
  1. 在服务器上打开根终端
  2. 检查是否安装了python
which python

应该返回

/usr/bin/python

如果没有,请参阅您的web主机手册以安装python。

  1. 检查是否安装了PIP
which pip

应返回

/usr/bin/pip

如果没有,可以使用get-pip.py脚本安装pip。

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm get-pip.py
  1. 安装python依赖项
pip install gunicorn aenum flask

设置脚本
  1. 使用您的用户帐户登录

通过根shell su - <username>或通过webhosts登录shell。

  1. 下载Speed Friending Matcher
cd ~
mdkir repos
cd repos
git clone https://github.com/machinekoder/speed-friending-and-dating-matcher.git
``3. Create a start script

```bash
cd ~
mkdir scripts
cd scripts
nano start-speed-friending-matcher.sh

#!/bin/bash
pgrep -x gunicorn
if [ $? -ne 0 ]; then
cd ~/repos/speed-friending-and-dating-matcher
gunicorn -w 4 wsgi:application -b localhost:5000
fi
chmod +x start-speed-friending-matcher.sh
  1. 设置crontab以启动脚本
crontab -e

插入

* * * * * ~/scripts/start-speed-friending-matcher.sh

现在等一分钟,你的服务器应该已经启动并运行了。

配置apache

使用网站的.htaccess创建一个RewriteRule到正在运行的gunicorn实例。

在本例中,我们将速度友好脚本放在路由/script/*上,其他所有路由都重定向到/index.php

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^script/(.*)$ http://localhost:5000/$1 [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [L]
</IfModule>

停止所有操作

首先,需要从crontabcrontab -e中删除启动脚本。

然后杀死所有正在运行的gunicorn实例killall gunicorn

扩展软件

您可以通过添加新的导入和导出插件来扩展软件。看看默认插件 csvimportertodoexporter了解更多详细信息。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java子类在构造函数中少取1个参数   arraylist在java中使用堆栈将对象添加到数组列表中   java如何使用扫描仪或缓冲读取器读取输入文件,并统计输入文件中出现的所有特定字符   java围绕其中心逆时针旋转2D数组,同时保持数组大小   java输入后,println不会输出任何内容   java未知HK2故障多重异常   SimplePath中字段的java Querydsl 4 StringExpression   循环遍历java代码中的多个集合   socket inputstream在使用BOX java sdk时损坏   java什么是面颊新闻活动?   列出比较多个整数并查找java中的最大整数   用户权限如何获得在java中Windows vista/7的C驱动器中打开目录的管理权限   范围内最大/最小值的java数据结构   文件如何使用Java下载和解压缩zip存档?   JavaSpring动态原型bean   类似于云浏览的java应用程序   java无法联系localhost:8005。关闭Tomcat时,Tomcat可能未运行错误