如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
A prototype for the Wikidata digital preservation portal.
Using virtual environments for Python will save a lot of pain and allow you to run Python 3 and Python 2 applications in harmony. If that sounds good then read this primer.
The portal is a Flask web application written in Python. It's currently easy to install as long as you have a Python 3 environment. Be aware that this is currently a local development installation, it's not ready for deployment as a reliable application to a server. We're working on that. That said there's a few stages to getting going:
Let's take a look in a little more detail. We've provided some helper scripts for virtualenv setup, deployment and running which we'll also point you to.
There's no helper script for this. Clone this repository and move into the project root directory:
bashgit clone https://github.com/WikiDP/portal-proto.git cd portal-proto
Alternatively download and unpack the source archive from this git repository. CODE_TOKEN_1` Once you've done this you can create the virtualenv for installation, or skip the next step if you have a Python 3 environment you're happy to use.
We need to create a Python virtualenv in the project root folder in a venv subdirectory and activate it thus:
bashvirtualenv -p python3 venv source ./venv/bin/activate
There's a helper script in the root directory you can run instead:
$ ./venv.sh. If this has worked your terminal prompt should be adorned with a venv marker, e.g. (venv) $.
You only need to create the virtualenv once, although you can remove it by simply deleting the venv subdirectory. You'll need to activate the virtualenv source ./venv/bin/activate every time you start a new terminal session.
Installing the application is straightforward using pip:
CODE_TOKEN_3Where the-e` switch tells pip to monitor the directory and recompile changes. This is useful for development but should be omitted for stable deployments.
Again there's a helper script for this: (venv) $ ./setup.sh.
The following steps need to be followed for every new terminal session.
You'll need to set up your Wikidata user name and password credentials, these can be exported as environment variables for now along with another variable that sets the flask application name:
bash(venv) $ export WIKIDP_BOT_USER='<username>' (venv) $ export WIKIDP_BOT_PASSWORD='<password>' (venv) $ export FLASK_APP='wikidp'
where <username> and <password> are your user name and password.
NOTE these will need to be set for every new session for now.
Finally run the Flask application:
CODE_TOKEN_5There's a script that you can use for this in the project root,run.sh`. You'll need to edit it once to provide your Wikdata credentials by replacing the placeholders in the script here:
bashexport WIKIDP_BOT_USER='<username>' export WIKIDP_BOT_PASSWORD='<password>'
Point your browser to http://127.0.0.1:5000 and you should see the prototype of the portal.
All Tests are currently in the tests/ directory. We use py.test to manage our testing interface.
CODE_TOKEN_7`
We have provided a bash script to handle the coverage reporting
bash(venv) $ ./coverage_report.sh
If you would prefer a more visual web-interface for the coverage report, this creates an htmlcov/index.html file for browser viewing CODE_TOKEN_9`
vagrant up
bashansible-galaxy install -r ansible/requirements.yml
Ansible CLI roll out to local Vagrant VM
bashansible-playbook --key-file=.vagrant/machines/default/virtualbox/private_key -v --inventory ansible/vagrant vagrant.yml
First time setup for any server via SSH, needs root password for server
bashansible-playbook ansible/setup.yml -i ansible/staging.yml -u root -vv -k
https://unix.stackexchange.com/questions/332641/how-to-install-python-3-6 wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz tar xvf Python-3.6.3.tgz cd Python-3.6.3 ./configure --enable-optimizations make -j8 sudo make altinstall python3.6
If you see something like:
shellUsage: flask run [OPTIONS] Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable. For more information see http://flask.pocoo.org/docs/latest/quickstart/
You need to set the FLASK_APP environment variable, see Quick Start above.
This code is released under the GPLv3 license.
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务