用于速度友好活动的匹配软件。
speed-friending-matcher的Python项目详细描述
快速交友和约会活动的匹配软件
此应用程序旨在使您的生活作为快速交友或快速约会活动的组织者更容易。我为一个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
- 在服务器上打开根终端
- 检查是否安装了python
which python
应该返回
/usr/bin/python
如果没有,请参阅您的web主机手册以安装python。
- 检查是否安装了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
- 安装python依赖项
pip install gunicorn aenum flask
设置脚本
- 使用您的用户帐户登录
通过根shell su - <username>
或通过webhosts登录shell。
- 下载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
- 设置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
。
扩展软件
您可以通过添加新的导入和导出插件来扩展软件。看看默认插件 csvimporter和todoexporter了解更多详细信息。