Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue install django-warp via pip #7

Open
soniok opened this issue Feb 14, 2018 · 14 comments
Open

Issue install django-warp via pip #7

soniok opened this issue Feb 14, 2018 · 14 comments

Comments

@soniok
Copy link

soniok commented Feb 14, 2018

Hello @enricofer,

I'm having and issue trying to install django-warp on a Ubuntu 16.04 LTS (in VirtualBox Linux Host) update to date.
No problem installing dependencies but could not install Django 1.9, instead installed Django 2.0.2.

What am I missing? Could anyone care to help guide me?
Thanks in advance,
Best regards,

Here is the output of history:

25 python --version
28 python3
30 sudo apt-get install python3-pip
33 pip3 install --upgrade pip
34 pip3 install Django==2.0.2
35 python3
39 sudo -H pip3 install django-apps
43 sudo -H pip3 install django-http-proxy
44 sudo -H pip3 install django-slugify
45 sudo -H pip3 install python-slugify
46 sudo -H pip3 install django-imagekit
47 sudo -H pip3 install psycopg2
48 sudo apt-get install git
49 sudo -H pip3 install django-raster
50 sudo apt-get install gdal-bin ogre-1.9-tools
51 sudo -H pip3 install gdal
52 sudo apt-get install libgdal-dev
53 sudo -H pip3 install gdal
54 sudo apt-get install libgdal1-1.11.3-grass
55 sudo apt-get install libgdal1-dev
56 sudo -H pip3 install gdal
57 sudo apt-get install python-gdal
58 sudo -H pip3 install gdal
59 easy_install3 GDAL
61 sudo -H easy_install3 GDAL
62 sudo apt-get install python-dev
63 sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev
64 sudo easy_install greenlet
65 sudo -H easy_install3 greenlet
66 sudo -H easy_install3 gevent
68 sudo -H pip3 install gdal
71 sudo apt-get install build-essential autoconf libtool pkg-config python3-opengl python3-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 libgle3 python3-dev libssl-dev
73 sudo apt install python3-gdal
74 sudo -H pip3 install gdal
75 pip3 install django-warp
76 sud -H pip3 install django-warp
77 sudo -H pip3 install django-warp
79 sud -H pip3 install libspatialindex
80 sudo -H pip3 install libspatialindex
81 sudo apt install libspatialindex
82 sudo apt install libspatialindex-dev -f
83 sudo -H pip3 install django-warp
84 sudo apt install x86_64-linux-gnu-gcc
85 sudo apt install libx86sudo apt-get install libgdal1i libgdal1-dev libgdal-dev
86 sudo apt-get install libgdal1i libgdal1-dev libgdal-dev
87 sudo apt-get auto-remove
88 gdal-config --version
89 sudo -H pip3 install pygdal==1.11.3
90 sudo -H pip3 install pygdal
91 sudo pip3 install pygdal
92 sudo pip3 install pygdal==1.11.3.3
93 python3
94 sudo -H pip3 install django-warp
95 export CPLUS_INCLUDE_PATH=/usr/include/gdal
96 export C_INCLUDE_PATH=/usr/include/gdal
97 pip3 install GDAL
98 sudo -H pip3 install django-warp
99 pip3 install django-warp
100 sudo apt-get install python3 python-dev python3-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev python-pip
101 sudo apt-get install python3 python-dev python3-dev build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev python3-pip
102 sudo -H pip3 install django-warp
103 sudo pip3 install django-warp
105 easy_install django-warp
106 sudo easy_install django-warp
107 sudo easy_install3 django-warp
108 sudo apt install gcc
109 sudo apt install shapelib
110 sudo easy_install3 django-warp
112 pip3 install Django==1.9
113 sudo pip3 install Django==1.9
114 sudo easy_install3 django-warp

Software Version Information:

mapwarper@mapwarper-web:~$ python
Python 2.7.12
(default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2

mapwarper@mapwarper-web:~$ python3
Python 3.5.2
(default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux

mapwarper@mapwarper-web:~$ pip --version
pip 9.0.1
from /home/mapwarper/.local/lib/python3.5/site-packages (python 3.5)

mapwarper@mapwarper-web:~$ pip freeze
amqp==2.2.2
apturl==0.5.2
beautifulsoup4==4.4.1
billiard==3.5.0.3
blinker==1.3
Brlapi==0.6.4
celery==4.1.0
chardet==2.3.0
checkbox-support==0.22
command-not-found==0.3
cryptography==1.2.3
defer==1.0.6
Django==2.0.2
django-appconf==1.0.2
django-apps==0.1.0
django-colorful==1.2
django-cors-headers==2.1.0
django-http-proxy==0.4.3
django-imagekit==4.0.2
django-raster==0.5
django-warp==0.5
feedparser==5.1.3
GDAL==1.11.3
greenlet==0.4.13
guacamole==0.9.2
html5lib==0.999
httplib2==0.9.1
idna==2.0
Jinja2==2.8
kombu==4.1.0
language-selector==0.1
louis==2.6.4
lxml==3.5.0
Mako==1.0.3
MarkupSafe==0.23
numpy==1.14.0
oauthlib==1.0.3
onboard==1.2.0
padme==1.1.1
pexpect==4.0.1
pilkit==2.0
Pillow==5.0.0
plainbox==0.25
psycopg2==2.7.4
ptyprocess==0.5
pyasn1==0.1.9
pycups==1.9.73
pycurl==7.43.0
pygdal==1.11.3.3
pygobject==3.20.0
PyJWT==1.3.0
PyOpenGL==3.0.2
pyparsing==2.2.0
python-apt==1.1.0b1
python-debian==0.1.27
python-slugify==1.2.4
python-systemd==231
pytz==2018.3
pyxdg==0.25
reportlab==3.3.0
requests==2.9.1
sessioninstaller==0.0.0
six==1.10.0
system-service==0.3
ubuntu-drivers-common==0.0.0
ufw==0.35
unattended-upgrades==0.1
Unidecode==1.0.22
unity-scope-calculator==0.1
unity-scope-chromiumbookmarks==0.1
unity-scope-colourlovers==0.1
unity-scope-devhelp==0.1
unity-scope-firefoxbookmarks==0.1
unity-scope-gdrive==0.7
unity-scope-manpages==0.1
unity-scope-openclipart==0.1
unity-scope-texdoc==0.1
unity-scope-tomboy==0.1
unity-scope-virtualbox==0.1
unity-scope-yelp==0.1
unity-scope-zotero==0.1
urllib3==1.13.1
usb-creator==0.3.0
vine==1.1.4
xdiagnose==3.8.4.1
xkit==0.0.0
XlsxWriter==0.7.3

Error msg when installing Django-warp:

mapwarper@mapwarper-web:~$ sudo pip3 install Django-warp
The directory '/home/mapwarper/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mapwarper/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: Django-warp in /usr/local/lib/python3.5/dist-packages/django_warp-0.5-py3.5.egg
Requirement already satisfied: Django>=1.9 in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: psycopg2 in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: django-cors-headers in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: django-http-proxy in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: python-slugify in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: django-imagekit in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: django-raster in /usr/local/lib/python3.5/dist-packages (from Django-warp)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from Django-warp)
Collecting GDAL>=2.2.0 (from Django-warp)
Downloading GDAL-2.2.3.tar.gz (475kB)
100% |████████████████████████████████| 481kB 1.4MB/s
Requirement already satisfied: pytz in ./.local/lib/python3.5/site-packages (from Django>=1.9->Django-warp)
Requirement already satisfied: Unidecode>=0.04.16 in /usr/local/lib/python3.5/dist-packages (from python-slugify->Django-warp)
Requirement already satisfied: pilkit>=0.2.0 in /usr/local/lib/python3.5/dist-packages (from django-imagekit->Django-warp)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from django-imagekit->Django-warp)
Requirement already satisfied: django-appconf>=0.5 in /usr/local/lib/python3.5/dist-packages (from django-imagekit->Django-warp)
Requirement already satisfied: celery>=4.0.2 in /usr/local/lib/python3.5/dist-packages (from django-raster->Django-warp)
Requirement already satisfied: django-colorful>=1.0.1 in /usr/local/lib/python3.5/dist-packages (from django-raster->Django-warp)
Requirement already satisfied: Pillow>=4.1.1 in /usr/local/lib/python3.5/dist-packages (from django-raster->Django-warp)
Requirement already satisfied: numpy>=1.9.1 in /usr/local/lib/python3.5/dist-packages (from django-raster->Django-warp)
Requirement already satisfied: pyparsing>=2.2.0 in /usr/local/lib/python3.5/dist-packages (from django-raster->Django-warp)
Requirement already satisfied: kombu<5.0,>=4.0.2 in /usr/local/lib/python3.5/dist-packages (from celery>=4.0.2->django-raster->Django-warp)
Requirement already satisfied: billiard<3.6.0,>=3.5.0.2 in /usr/local/lib/python3.5/dist-packages (from celery>=4.0.2->django-raster->Django-warp)
Requirement already satisfied: amqp<3.0,>=2.1.4 in /usr/local/lib/python3.5/dist-packages (from kombu<5.0,>=4.0.2->celery>=4.0.2->django-raster->Django-warp)
Requirement already satisfied: vine>=1.1.3 in /usr/local/lib/python3.5/dist-packages (from amqp<3.0,>=2.1.4->kombu<5.0,>=4.0.2->celery>=4.0.2->django-raster->Django-warp)
Installing collected packages: GDAL
Found existing installation: GDAL 1.11.3
DEPRECATION: Uninstalling a distutils installed project (GDAL) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling GDAL-1.11.3:
Successfully uninstalled GDAL-1.11.3
Running setup.py install for GDAL ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-qtp2ebr0/GDAL/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-jghn6xsi-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
copying gdal.py -> build/lib.linux-x86_64-3.5
copying ogr.py -> build/lib.linux-x86_64-3.5
copying osr.py -> build/lib.linux-x86_64-3.5
copying gdalconst.py -> build/lib.linux-x86_64-3.5
copying gnm.py -> build/lib.linux-x86_64-3.5
copying gdalnumeric.py -> build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/init.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-3.5/osgeo
copying osgeo/gdal.py -> build/lib.linux-x86_64-3.5/osgeo
Fixing build/lib.linux-x86_64-3.5/gdal.py build/lib.linux-x86_64-3.5/ogr.py build/lib.linux-x86_64-3.5/osr.py build/lib.linux-x86_64-3.5/gdalconst.py build/lib.linux-x86_64-3.5/gnm.py build/lib.linux-x86_64-3.5/gdalnumeric.py build/lib.linux-x86_64-3.5/osgeo/ogr.py build/lib.linux-x86_64-3.5/osgeo/osr.py build/lib.linux-x86_64-3.5/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.5/osgeo/gdalconst.py build/lib.linux-x86_64-3.5/osgeo/init.py build/lib.linux-x86_64-3.5/osgeo/gdal_array.py build/lib.linux-x86_64-3.5/osgeo/gnm.py build/lib.linux-x86_64-3.5/osgeo/gdal.py
Skipping optional fixer: ws_comma
Fixing build/lib.linux-x86_64-3.5/gdal.py build/lib.linux-x86_64-3.5/ogr.py build/lib.linux-x86_64-3.5/osr.py build/lib.linux-x86_64-3.5/gdalconst.py build/lib.linux-x86_64-3.5/gnm.py build/lib.linux-x86_64-3.5/gdalnumeric.py build/lib.linux-x86_64-3.5/osgeo/ogr.py build/lib.linux-x86_64-3.5/osgeo/osr.py build/lib.linux-x86_64-3.5/osgeo/gdalnumeric.py build/lib.linux-x86_64-3.5/osgeo/gdalconst.py build/lib.linux-x86_64-3.5/osgeo/init.py build/lib.linux-x86_64-3.5/osgeo/gdal_array.py build/lib.linux-x86_64-3.5/osgeo/gnm.py build/lib.linux-x86_64-3.5/osgeo/gdal.py
Skipping optional fixer: ws_comma
running build_ext
building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/extensions
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python3.5m -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.5/extensions/gdal_wrap.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp:3168:22: fatal error: cpl_port.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Rolling back uninstall of GDAL
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-build-qtp2ebr0/GDAL/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-jghn6xsi-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-qtp2ebr0/GDAL/

@enricofer
Copy link
Owner

enricofer commented Feb 14, 2018

Your problem is GDAL: https://stackoverflow.com/questions/37294127/python-gdal-2-1-installation-on-ubuntu-16-04
but even you if get it installed I'm not sure it will run on django 2. Let me now if it goes.

@soniok
Copy link
Author

soniok commented Feb 14, 2018

Hello Enricofer,

Thanks for your help. I succesfully installed GDAL, then installed Django-warp via pip with no errors.
I'll be honest, I have never used Django/Python. I'm stuck trying to understand what I need to do with the setup process:
Could you please explain what files I need to modify?
How do I run the server?

Add django_warp to your INSTALLED_APPS

(Where is INSTALLED_APPS?)

Add url(r'^warp/', include('django_warp.urls')), to site urls.py

(Where is urls.py?)

./manage.py makemigrations django_warp and ./manage.py migrate to create db context

(where is ./ ?)

Run server and browse to [yourserver address]\warp\ and login with a valid site credentials

(What command to run server).

@enricofer
Copy link
Owner

enricofer commented Feb 14, 2018

I suggest you the awesome tutorial from djangogirls: https://tutorial.djangogirls.org/en/django_installation/index.html (in many other languages too)
Read it and then we will be able to talk about install

@soniok
Copy link
Author

soniok commented Feb 14, 2018

Thanks for the suggestion, I've just read it. I understand now your directions and I executed them with no errors. But there is an error when accessing 127.0.0.1:8000/warp/.

This time I setup and virtual environment, and installed Django version 1.9 (ended up being 1.9.13).
I create a new site, added django_warp to INSTALLED_APPS,
then added url(r'^warp/', include('django_warp.urls')) to site urls.py in /mysite/.
then:

(warpenv) mapwarper@mapwarper-web:~/warp$ ./manage.py makemigrations django_warp
No changes detected in app 'django_warp'

(warpenv) mapwarper@mapwarper-web:~/warp$ ./manage.py migrate
Operations to perform:
Apply all migrations: sites, django_warp, auth, sessions, admin, contenttypes, httpproxy
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying django_warp.0001_initial... OK
Applying django_warp.0002_auto_20170727_0821... OK
Applying django_warp.0003_datasets_vrt... OK
Applying django_warp.0004_datasets_transparency... OK
Applying httpproxy.0001_initial... OK
Applying httpproxy.0002_auto_20160121_1940... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK

(warpenv) mapwarper@mapwarper-web:~/warp$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
February 14, 2018 - 18:07:20
Django version 1.9.13, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /
[14/Feb/2018 18:07:42] "GET / HTTP/1.1" 404 2009
Not Found: /favicon.ico
[14/Feb/2018 18:07:43] "GET /favicon.ico HTTP/1.1" 404 2042
[14/Feb/2018 18:07:52] "GET /warp HTTP/1.1" 301 0
[14/Feb/2018 18:07:52] "GET /warp/ HTTP/1.1" 302 0
Internal Server Error: /warp/login/
Traceback (most recent call last):
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/sites/models.py", line 44, in _get_site_by_request
SITE_CACHE[host] = self.get(domain__iexact=host)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/query.py", line 387, in get
self.model._meta.object_name
django.contrib.sites.models.DoesNotExist: Site matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/auth/views.py", line 49, in inner
return func(*args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/auth/views.py", line 82, in login
current_site = get_current_site(request)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/sites/shortcuts.py", line 15, in get_current_site
return Site.objects.get_current(request)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/sites/models.py", line 67, in get_current
return self._get_site_by_request(request)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/sites/models.py", line 52, in _get_site_by_request
SITE_CACHE[domain] = self.get(domain__iexact=domain)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/query.py", line 387, in get
self.model._meta.object_name
django.contrib.sites.models.DoesNotExist: Site matching query does not exist.

Output of webpage in debug mode:

DoesNotExist at /warp/login/

Site matching query does not exist.

Request Method: GET
Request URL: http://127.0.0.1:8000/warp/login/?next=/warp/
Django Version: 1.9.13
Exception Type: DoesNotExist
Exception Value:

Site matching query does not exist.

Exception Location: /home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/query.py in get, line 387
Python Executable: /home/mapwarper/warp/warpenv/bin/python
Python Version: 3.5.2
Python Path:

['/home/mapwarper/warp',
'/usr/lib/python35.zip',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/home/mapwarper/warp/warpenv/lib/python3.5/site-packages']

Server time: Wed, 14 Feb 2018 18:40:50 +0000

What am I doing wrong this time?

@soniok
Copy link
Author

soniok commented Feb 14, 2018

Here a tree of my current project folder:

(warpenv) mapwarper@mapwarper-web:~/warp$ tree -L 2
.
├── db.sqlite3
├── django_warp
│   ├── admin.py
│   ├── apps.py
│   ├── bak
│   ├── forms.py
│   ├── init.py
│   ├── migrations
│   ├── models.py
│   ├── pycache
│   ├── static
│   ├── templates
│   ├── templatetags
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── manage.py
├── mysite
│   ├── init.py
│   ├── pycache
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
|── warpenv
│ ├── bin
│ ├── include
│ ├── lib
│ ├── lib64 -> lib
│ ├── man
│ ├── pip-selfcheck.json
│ ├── pyvenv.cfg
│ └── share

16 directories, 16 files

@enricofer
Copy link
Owner

could you provide me mysite/settings.py ?
I fear you haven't 'django.contrib.auth' in INSTALLED_APPS

@soniok
Copy link
Author

soniok commented Feb 14, 2018

It's seems I do have it. Also you may notice I added httpproxy in INSTALLED_APPS because I got error where it said it was missing it, so I added it above django_warp.

mysite/settings.py

"""
Django settings for mysite project.

Generated by 'django-admin startproject' using Django 1.9.13.

For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""

import os

Build paths inside the project like this: os.path.join(BASE_DIR, ...)

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

Quick-start development settings - unsuitable for production

See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/

SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY = '@eeuid^y0azz98wx70uow0ejo6%31p5zvy$@afg$ivrj*$p0q('

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = True

#ALLOWED_HOSTS = []
#added per girl tutorial
ALLOWED_HOSTS = ['127.0.0.1']

Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'httpproxy',
'django_warp',
]

MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'mysite.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'mysite.wsgi.application'

Database

https://docs.djangoproject.com/en/1.9/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

Password validation

https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

Internationalization

https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True

Static files (CSS, JavaScript, Images)

https://docs.djangoproject.com/en/1.9/howto/static-files/

STATIC_URL = '/static/'
#added per girl tutorial
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')

@soniok
Copy link
Author

soniok commented Feb 14, 2018

In case you ask, here is output of mysite/urls.py. You may noticed here also, I added include to " from django.conf.urls import url, ..."

"""mysite URL Configuration

The urlpatterns list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^warp/', include('django_warp.urls')),
]

@soniok
Copy link
Author

soniok commented Feb 14, 2018

Ok I fixed this error with help from comment: https://stackoverflow.com/a/37937755

When you include the django.contrib.sites to your INSTALLED_APPS and run the command "python manage.py migrate" the app automatically creates a object into "django_site" table (with domain name and display name equals to "example.com". There is no need to create it by yourself.

Probably you just need to add the setting SITE_ID = 1 to your settings.py file.

answered Jun 21 '16 at 7:11 by Ricardo Silva
https://stackoverflow.com/a/37937755
https://stackoverflow.com/questions/11476210/getting-site-matching-query-does-not-exist-error-after-creating-django-admin/37937755

So I added that variable setting to mysite/settings.py and ran the server again and sucessfully loaded the login page with no errors.

Just need to figure out how to register/setup an account.

EDIT: To create superuser, execute and follow:

python manage.py createsuperuser
Then add all permissions to that user via admin in 127.0.0.1:8000/admin/

@soniok
Copy link
Author

soniok commented Feb 14, 2018

I managed to create a new dataset and upload an images, then an error appears.
The image uploaded cannot be seen on georeferencing page. The left map box stays white. I made sure not to use an .jp2 (Jpeg2000) image and used a .PNG image.
Here are some errors from web server console, may it be an error about paths?

PS: Does Django-Warp support jp2 (Jpeg2000)?

(warpenv) mapwarper@mapwarper-web:~/warp$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
February 14, 2018 - 23:26:58
Django version 1.9.13, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/template/defaulttags.py:499: RemovedInDjango110Warning: Reversing by dotted path is deprecated (django.contrib.auth.views.logout).
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)

[14/Feb/2018 23:27:02] "GET /warp/ HTTP/1.1" 200 6902
[14/Feb/2018 23:27:14] "GET /warp/1/ HTTP/1.1" 200 7685
Not Found: /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg
Not Found: /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg HTTP/1.1" 404 6110
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg HTTP/1.1" 404 6251
Not Found: /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg
Not Found: /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg HTTP/1.1" 404 6251
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg HTTP/1.1" 404 6110
/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/template/smartif.py:168: RemovedInDjango110Warning: Operator '=' is deprecated and will be removed in Django 1.10. Use '==' instead.
mapped_tokens.append(self.translate_token(token))

[14/Feb/2018 23:27:19] "GET /warp/imgset/2/ HTTP/1.1" 200 35849
Not Found: /warp/imgset/2/warp/0002_s_output.png
[14/Feb/2018 23:27:19] "GET /warp/imgset/2/warp/0002_s_output.png?dum=9576136 HTTP/1.1" 404 6005

1 similar comment
@soniok
Copy link
Author

soniok commented Feb 14, 2018

I managed to create a new dataset and upload an images, then an error appears.
The image uploaded cannot be seen on georeferencing page. The left map box stays white. I made sure not to use an .jp2 (Jpeg2000) image and used a .PNG image.
Here are some errors from web server console, may it be an error about paths?

PS: Does Django-Warp support jp2 (Jpeg2000)?

(warpenv) mapwarper@mapwarper-web:~/warp$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
February 14, 2018 - 23:26:58
Django version 1.9.13, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/template/defaulttags.py:499: RemovedInDjango110Warning: Reversing by dotted path is deprecated (django.contrib.auth.views.logout).
url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)

[14/Feb/2018 23:27:02] "GET /warp/ HTTP/1.1" 200 6902
[14/Feb/2018 23:27:14] "GET /warp/1/ HTTP/1.1" 200 7685
Not Found: /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg
Not Found: /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg HTTP/1.1" 404 6110
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg HTTP/1.1" 404 6251
Not Found: /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg
Not Found: /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0001_s_IGNF_PVA_1-0__1935__CCF0C-2381_1935_CAF_C-238_0002bis/054969915f465018a4fdc67d9e5c1bdb.jpg HTTP/1.1" 404 6251
[14/Feb/2018 23:27:14] "GET /warp/1/CACHE/images/warp/0002_s_output/0a433cea60611f23f87668350f433e8d.jpg HTTP/1.1" 404 6110
/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/template/smartif.py:168: RemovedInDjango110Warning: Operator '=' is deprecated and will be removed in Django 1.10. Use '==' instead.
mapped_tokens.append(self.translate_token(token))

[14/Feb/2018 23:27:19] "GET /warp/imgset/2/ HTTP/1.1" 200 35849
Not Found: /warp/imgset/2/warp/0002_s_output.png
[14/Feb/2018 23:27:19] "GET /warp/imgset/2/warp/0002_s_output.png?dum=9576136 HTTP/1.1" 404 6005

@enricofer
Copy link
Owner

enricofer commented Feb 15, 2018 via email

@soniok
Copy link
Author

soniok commented Feb 15, 2018

Ok everything seems to work. I'm able to upload, georeference and generate .tiff, download-dataset(georeferenced .tiff). All the thumbnails are working.
Here are the corrections a made to fix wrong path to images/thumbnails:

  • Add to end of mysite/settings.py

#My folder containing django project:
MEDIA_ROOT = '/home/mapwarper/warp/'

#Url base that will reference to media content I guess. I named it 'img':
MEDIA_URL = 'http://127.0.0.1:8000/warp/img/'

  • Add to end of django_warp/urls.py

url(r'^img/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),

The only error I have now, is I cannot delete an image from a dataset. When I click on X to delete, then confirm the alert/confirm box, I get this error:
http://dpaste.com/11XPXJG

Traceback:

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute
323. return Database.Cursor.execute(self, query, params)

The above exception (NOT NULL constraint failed: django_warp_datasets.transparency) was the direct cause of the following exception:

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
149. response = self.process_exception_by_middleware(e, request)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
147. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)

File "/home/mapwarper/warp/django_warp/views.py" in trash_image
368. trash_dataset.save()

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/base.py" in save
708. force_update=force_update, update_fields=update_fields)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/base.py" in save_base
736. updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/base.py" in _save_table
820. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/base.py" in _do_insert
859. using=using, raw=raw)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
122. return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/query.py" in _insert
1039. return query.get_compiler(using=using).execute_sql(return_id)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
1060. cursor.execute(sql, params)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
79. return super(CursorDebugWrapper, self).execute(sql, params)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/utils.py" in exit
95. six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
64. return self.cursor.execute(sql, params)

File "/home/mapwarper/warp/warpenv/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py" in execute
323. return Database.Cursor.execute(self, query, params)

Exception Type: IntegrityError at /warp/trashimage/2/
Exception Value: NOT NULL constraint failed: django_warp_datasets.transparency

PS: Thanks for your help and time Enricofer.

@enricofer
Copy link
Owner

enricofer commented Feb 16, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants