Search code examples
installationopenstreetmapcollectstatic

umap collectstatic gives "No such file or directory" error


As I have very little knowledge about Linux, pretty much all I can do is copy and paste things from a good tutorial and in most cases simply hope nothing goes wrong. I really tried finding a solution on my own and searching the internet but to no avail (I found a number of quite similar things but no solution I understood enough to be able to adapt it on my own to fix my problem).

I've installed an osm tile server using this amazing tutorial and it works like a charm. Now I want to install umap, using this tutorial.

Everything works fine until I get to the line "umap collectstatic". The error I get is this:

 (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'

Now, I get the something might be wrong with a setting in a config file somewhere, but changing the directory in local.py doesn't seem to do anything (like I have set it to STATIC_ROOT = '/home/xxx_myusername_xxx/umap/var/static') - I have no idea where this "/home/ybon/Code/..." path even comes from! What settings ?

I sure didn't specify THIS path anywhere! And the folder is indeed nowhere to be found on my machine. Maybe using virtualenv is somehow generating it, and I can't find it on my machine because it IS virtual (as in "not really there physically") but this is just a very wild guess and I don't really know what I'm talking about.

(I tried running the command with and without sudo and it doesn't change anything).


Solution

  • I have always wanted to install a tile server and have tried the tutorials you have given today. So I'm a learner like you!

    Installing the Tile Server with the tutorial https://www.linuxbabe.com/linux-server/openstreetmap-tile-server-ubuntu-16-04 was really straightforward. I only used the part for Rhineland Palatinate.

    With Umap (https://umap-project.readthedocs.io/en/latest/ubuntu/#tutorial) I had some problems. 1. A port was used twice. I changed the port for Apache. 2. After creating the local configuration (wget https://raw.githubusercontent.com/umap-project/umap/master/umap/settings/local.py.sample -O /etc/umap/umap.conf) this file was not immediately recognized. I helped myself by changing the file before executing the command "umap migrate". I have made the following changes:

    # 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 I have changed, because so the user umap has all permissions. Then I set the envirement variable UMAP_SETTINGS because otherwise the settings file /etc/umap/umap.conf is not found.

    ( I also have no idea where this "/home/ybon/Code/..." path comes from. After the configuration file is properly loaded, the path is loaded from the configuration file. That's why that's not important anymore. )

    Now I could use the following commands without errors:

    (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/
    

    And finally I was able to use umap.

    enter image description here