1

由于我对 Linux 知之甚少,我所能做的几乎就是从一个好的教程中复制和粘贴内容,并且在大多数情况下只是希望不会出错。我真的尝试过自己寻找解决方案并搜索互联网,但无济于事(我发现了许多非常相似的东西,但没有解决方案我理解到能够自行调整以解决我的问题)。

我已经使用这个惊人的教程安装了一个 osm tile 服务器,它就像一个魅力。现在我想使用本教程安装 umap 。

一切正常,直到我到达“umap collectstatic”这一行。我得到的错误是这样的:

 (venv) $ sudo umap collectstatic
 [sudo] Passwort für umap2: 

You have requested to collect static files at the destination
location as specified in your settings:

/home/ybon/.virtualenvs/umap/var/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "/usr/local/bin/umap", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/umap/bin/__init__.py", line 12, in main
management.execute_from_command_line()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 193, in handle
collected = self.collect()
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 115, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/finders.py", line 112, in list
for path in utils.get_files(storage, ignore_patterns):
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py", line 399, in listdir
for entry in os.listdir(path):
OSError: [Errno 2] No such file or directory: '/home/ybon/Code/js/Leaflet.Storage'

现在,我发现某处的配置文件中的设置可能有问题,但是更改 local.py 中的目录似乎没有任何作用(就像我已将其设置为 STATIC_ROOT = '/home/xxx_myusername_xxx/umap/ var/static') - 我不知道这个“/home/ybon/Code/...”路径是从哪里来的!什么设置?

我确定没有在任何地方指定此路径!在我的机器上确实找不到该文件夹​​。也许使用 virtualenv 会以某种方式生成它,但我无法在我的机器上找到它,因为它是虚拟的(如“实际上并不存在”),但这只是一个非常疯狂的猜测,我真的不知道我是什么我在谈论。

(我尝试在有和没有 sudo 的情况下运行该命令,但它不会改变任何东西)。

4

1 回答 1

0

我一直想安装一个磁贴服务器,并尝试了你今天给出的教程。所以我和你一样是学习者!

使用教程https://www.linuxbabe.com/linux-server/openstreetmap-tile-server-ubuntu-16-04安装 Tile Server非常简单。我只使用了莱茵兰普法尔茨的零件。

使用 Umap(https://umap-project.readthedocs.io/en/latest/ubuntu/#tutorial)我遇到了一些问题。1.一个端口被使用了两次。我更改了 Apache 的端口。2.创建本地配置后(wget https://raw.githubusercontent.com/umap-project/umap/master/umap/settings/local.py.sample -O /etc/umap/umap.conf)这个文件是没有立即认出。在执行命令“umap migrate”之前,我通过更改文件来帮助自己。我做了以下更改:

# For static deployment
STATIC_ROOT = '/etc/umap/var/static'

# For users' statics (geojson mainly)
MEDIA_ROOT = '/etc/umap/umap/var/data'

# Umap Settings
UMAP_SETTINGS='/etc/umap/umap.conf'

STATIC_ROOTMEDIA_ROOT我已经改变了,因为用户 umap 拥有所有权限。然后我设置环境变量UMAP_SETTINGS,否则/etc/umap/umap.conf找不到设置文件。

(我也不知道这个“/home/ybon/Code/...”路径是从哪里来的。配置文件正确加载后,从配置文件中加载路径。这就是为什么它不再重要了。)

现在我可以使用以下命令而不会出错:

(venv) $ umap collectstatic
Loaded local config from /etc/umap/umap.conf

You have requested to collect static files at the destination
location as specified in your settings:

    /etc/umap/var/static

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Copying '/srv/umap/venv/lib/python3.5/site-packages/umap/static/favicon.ico'
...
290 static files copied to '/etc/umap/var/static'.
(venv) $ umap storagei18n
Loaded local config from /etc/umap/umap.conf
Processing English
Found file /etc/umap/var/static/storage/src/locale/en.json
Exporting to /etc/umap/var/static/storage/src/locale/en.js
..
Processing Deutsch
Found file /etc/umap/var/static/storage/src/locale/de.json
..
Found file /etc/umap/var/static/storage/src/locale/sk_SK.json
Exporting to /etc/umap/var/static/storage/src/locale/sk_SK.js
(venv) $ umap createsuperuser
Loaded local config from /etc/umap/umap.conf
Username (leave blank to use 'umap'): 
Email address: 
Password: 
Password (again): 
Superuser created successfully.
(venv) $ umap runserver 0.0.0.0:8000
Loaded local config from /etc/umap/umap.conf
Loaded local config from /etc/umap/umap.conf
Performing system checks...

System check identified no issues (0 silenced).
April 09, 2018 - 14:02:15
Django version 1.10.5, using settings 'umap.settings'
Starting development server at http://0.0.0.0:8000/

最后我可以使用umap了。

在此处输入图像描述

于 2018-04-09T14:45:31.123 回答