【问题标题】:umap collectstatic gives "No such file or directory" errorumap collectstatic 给出“没有这样的文件或目录”错误
【发布时间】:2018-09-14 16:09:12
【问题描述】:

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

我已经使用this amazing tutorial 安装了一个 osm tile 服务器,它的工作原理就像一个魅力。现在我想安装umap,使用this tutorial

一切正常,直到我到达“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 运行命令,但它没有改变任何东西)。

【问题讨论】:

    标签: installation openstreetmap collectstatic


    【解决方案1】:

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

    使用教程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_ROOT und MEDIA_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了。

    【讨论】:

    • 非常感谢您的帮助,我终于启动并运行了!
    猜你喜欢
    • 2014-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-08
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    • 2023-02-02
    相关资源
    最近更新 更多