umap collectstatic给出了#34;没有这样的文件或目录"错误

时间:2018-04-04 23:57:00

标签: installation openstreetmap collectstatic

由于我对Linux知之甚少,我所能做的就是从一个好的教程中复制和粘贴东西,在大多数情况下只希望没有出错。我真的试图自己寻找一个解决方案并在网上搜索但无济于事(我找到了一些非常相似的东西,但没有解决方案我理解得足以能够自己调整以解决我的问题)。

我已经使用this amazing tutorial安装了一个osm tile服务器,它就像一个魅力。现在我想使用this tutorial安装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中的目录 没有按&#39;吨似乎无所不能(就像我已经将它设置为STATIC_ROOT =&#39; /家/ xxx_myusername_xxx / UMAP在/ var /静态&#39;) - 我不知道在哪里这个&#34; /家/ ybon /代码/...&# 34;路径甚至来自!什么设置?

我确定没有在任何地方指定这条路径!在我的机器上确实无法找到该文件夹​​。也许使用的virtualenv不知何故发生了,我可以&#39;吨发现它在我的机器上,因为它是虚拟的(如在&#34;不是真的存在物理&#34;),但是这仅仅是一个很偏僻的猜测,我不和#39;我真的知道我在说什么。

(我尝试使用和不使用sudo运行命令,它不会改变任何东西)。

1 个答案:

答案 0 :(得分: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具有所有权限。然后我设置了envirement变量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。

enter image description here