Suiteáil GeodJangoLink to this heading

ForbhreathnúLink to this heading

Go ginearálta, éilíonn suiteáil GeodJango:

  1. <django>:ref: `Python agus Django `

  2. Bunachar sonraí spásúil

  3. Leabharlanna geospásúla

Cuirtear sonraí maidir le gach ceann de na riachtanais agus na treoracha suiteála ar fáil sna hailt thíos. Ina theannta sin, tá treoracha ardán-shonracha ar fáil do:

RiachtanaisLink to this heading

Python agus DjangoLink to this heading

<installing-official-release>Toisc go bhfuil GeodJango san áireamh le Django, féach le do thoil Django's:ref: `treoracha suiteála `le haghaidh sonraí maidir le conas a shuiteáil.

Bunachar sonraí spásúilLink to this heading

Is iad PostgreSQL (le PostGIS), MySQL, Oracle, agus SQLite (le SpatiaLite) na bunachair sonraí spásúla a dtacaítear leo faoi láthair.

The geospatial libraries required for a GeoDjango installation depends on the spatial database used. The following lists the library requirements, supported versions, and any notes for each of the supported database backends:

Bunachar Sonraí

Ceanglais Leabharlan

Leaganacha Tacaithe

Nótaí

PostgreSQL

GEOS, GDAL, PROJ, PostGIS

14+

Éilíonn PostGIS.

MySQL

GEOS, GDAL

8.0.11+

<mysql-spatial-limitations>:ref: `Feidhmiúlacht theoranta `.

Oracle

GEOS, GDAL

19+

Ní thacaítear le XE.

SQLite

GEOS, GDAL, PROJ, SPATALITE

3.31+

Éilíonn Spatialite 4.3+

Féach freisin `an maitrís chomparáide seo `__ ar an OSGeo Wiki le haghaidh teaglaim féideartha PostgreSQL/PostGIS/Geos/GDal.

SuiteáilLink to this heading

Leabharlanna geospásúlaLink to this heading

Suiteáil bunachar sonraíLink to this heading

DATABASES configurationLink to this heading

<spatial-backends>Socraigh an socrú: socrú: INNEALL <DATABASE-ENGINE>`go ceann de na: ref: `cúltaca spásúla.

Cuir django.contrib.gis chuig: socrú: INSTALLED_APPSLink to this heading

Cosúil le feidhmchláir contrib Django eile, ní mór duit* amháin a chur leis: mod: django.contrib.gis chuig: setting: INSTALLED_APPS i do shocruithe. Tá sé seo ionas gur féidir na teimpléid gis a shuíomh - mura ndéantar iad, ansin ní fheidhmeoidh gnéithe mar an riarachán geografach nó léarscáileanna láithreáin KML i gceart.

FabhtcheartúLink to this heading

Mura féidir leat an réiteach ar do fhadhb a fháil anseo ansin páirt sa phobal! Is féidir leat:

  • Cuir do cheist ar an bhfóram `GeodJango`__.

  • File a ticket on the `Django trac`__ if you think there's a bug. Make sure to provide a complete description of the problem, versions used, and specify the component as "GIS".

Socruithe timpeallachta leabharLink to this heading

Go fada, is é an fhadhb is coitianta agus GeodJango á shuiteáil ná nach féidir na leabharlanna roinnte seachtracha (m.sh., do GEOS agus GDAL) a lonnú. [#] _ De ghnáth, is é cúis leis an bhfadhb seo ná nach bhfuil an córas oibriúcháin ar an eolaire ina suiteáilíodh na leabharlanna tógtha ó fhoinse.

Go ginearálta, féadfar cosán an leabharlainne a shocrú ar bhonn in aghaidh an úsáideora trí athróg comhshaoil a shocrú, nó trí chonair an leabharlainne a chumrú don chóras iomlán.

Athróg comhshaoil LD_LIBRARY_PATHLink to this heading

A user may set this environment variable to customize the library paths they want to use. The typical library directory for software built from source is /usr/local/lib. Thus, /usr/local/lib needs to be included in the LD_LIBRARY_PATH variable. For example, the user could place the following in their bash profile:

Shell
export LD_LIBRARY_PATH=/usr/local/lib

Cosán leabharlainne córais a shocrúLink to this heading

On GNU/Linux systems, there is typically a file in /etc/ld.so.conf, which may include additional paths from files in another directory, such as /etc/ld.so.conf.d. As the root user, add the custom library path (like /usr/local/lib) on a new line in ld.so.conf. This is one example of how to do so:

Shell
$ sudo echo /usr/local/lib >> /etc/ld.so.conf
$ sudo ldconfig

For OpenSolaris users, the system library path may be modified using the crle utility. Run crle with no options to see the current configuration and use crle -l to set with the new library path. Be very careful when modifying the system library path:

Shell
# crle -l $OLD_PATH:/usr/local/lib

Suiteáil binutilsLink to this heading

GeoDjango uses the find_library function (from the ctypes.util Python module) to discover libraries. The find_library routine uses a program called objdump (part of the binutils package) to verify a shared library on GNU/Linux systems. Thus, if binutils is not installed on your Linux system then Python's ctypes may not be able to find your library even if your library path is set correctly and geospatial libraries were built perfectly.

Is féidir an pacáiste ``binutils` a shuiteáil ar chórais Debian agus Ubuntu ag baint úsáide as an ordú seo a leanas:

Shell
$ sudo apt-get install binutils

Ar an gcaoi chéanna, ar chórais Red Hat agus CentOS:

Shell
$ sudo yum install binutils

Treoracha sonracha don ardánLink to this heading

macOSLink to this heading

Mar gheall ar an éagsúlacht na gcóras pacáistithe atá ar fáil do MacOS, tá roinnt roghanna éagsúla ag úsáideoirí chun GeodJango a shuiteáil. Is iad na roghanna seo:

Cuimsíonn an chuid seo treoracha freisin maidir le leagan uasghrádaithe de:ref: macos_python a shuiteáil ó phacáistí a sholáthraíonn Fondúireacht Bogearraí Python, áfach, níl sé seo ag teastáil.

PythonLink to this heading

Although macOS comes with Python installed, users can use `framework installers`__ provided by the Python Software Foundation. An advantage to using the installer is that macOS's Python will remain "pristine" for internal operating system use.

Postgres.appLink to this heading

Postgres.app is a standalone PostgreSQL server that includes the PostGIS extension. You will also need to install gdal with Bailebrew.

Tar éis Postgres.app a shuiteáil, cuir an méid seo a leanas le do .bash_profile` ionas gur féidir leat cláir an phacáiste a reáchtáil ón líne ordaithe. Cuir leagan PostgreSQL in ionad X.Y` sa Postgres.app a shuiteáil tú:

Shell
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/X.Y/bin

Is féidir leat a sheiceáil an bhfuil an cosán curtha ar bun i gceart trí chlóscríobh which psql ag pras críochfoirt.

BailebrewLink to this heading

Soláthraíonn `Homebrew`__ “oidis” chun dénártha agus pacáistí a thógáil ón bhfoinse. Soláthraíonn sé oidis do na réamhriachtanais GeodJango ar ríomhairí Macintosh atá ag rith macOS. Toisc go dtógann Homebrew na bogearraí ó fhoinse fós, tá Xcode ag teastáil.

Achoimre:

Shell
$ brew install postgresql
$ brew install postgis
$ brew install gdal
FinkLink to this heading

Bhí `Kurt Schwehr`__ grásta go leor chun pacáistí GeodJango a chruthú d'úsáideoirí an chórais pacáiste `Fink`__. Tá pacáistí éagsúla ar fáil `__ (ag tosú le ``django-gis`), ag brath ar an leagan de Python is mian leat a úsáid.

MacPortsLink to this heading

`MacPorts`__ may be used to install GeoDjango prerequisites on computers running macOS. Because MacPorts still builds the software from source, Xcode is required.

Achoimre:

Shell
$ sudo port install postgresql14-server
$ sudo port install geos
$ sudo port install proj6
$ sudo port install postgis3
$ sudo port install gdal

FuinneogaLink to this heading

Lean ar aghaidh tríd na codanna seo a leanas go seicheamhach d'fhonn GeodJango a shuiteáil ar Windows. Sa rang teagaisc seo, suiteálfaimid leaganacha 64 giotán de gach feidhmchlár.

PythonLink to this heading

Suiteáil leagan 64 giotán de Python. Féach: Doc: Suiteáil Python le haghaidh tuilleadh faisnéise </howto/windows>.

PostgreSQLLink to this heading

Download the latest `PostgreSQL 15.x installer`__ from the `EnterpriseDB`__ website. After downloading, run the installer, follow the on-screen directions, and keep the default options unless you know the consequences of changing them.

Nuair a chríochnaíonn an suiteálaí, iarrfaidh sé “Seoladh Tógálaí Stack ag imeacht?” - coinnigh é seo a sheiceáil, mar is gá a shuiteáil:ref: postgisasb.

PostGISLink to this heading

Ón taobh istigh den Tógálaí Stack (chun rith lasmuigh den suiteálaí, :menuselection: Start --> PostgreSQL 15 --> Tógálaí Stack Iarrataire), roghnaigh: menuselection: PostgreSQL 15 (x64) ar chalafort 5432 ón roghchlár anuas agus cliceáil ar aghaidh. Leathnaigh an crann roghchláir: menuselection: Catagóirí --> Síneadh spásúil agus roghnaigh: menuselection: PostGIS X.Y do PostgreSQL 15.

Tar éis duit cliceáil ar aghaidh, cuirfear ort an pacáiste roghnaithe a dhearbhú agus “Íoslódáil eolaire”. Cliceáil ar aghaidh arís, íoslódóidh sé seo PostGIS agus iarrfar ort cliceáil in aice le suiteálaí PostGIS a thosú. Roghnaigh na roghanna réamhshocraithe le linn suite Cuimsíonn an próiseas suiteála ceithre bhosca dialóige Tai/Níl, is é “Níl” an rogha réamhshocraithe do gach ceathrar.

OSGeo4wLink to this heading

The OSGeo4W installer helps to install the PROJ, GDAL, and GEOS libraries required by GeoDjango. First, download the OSGeo4W installer, and run it. Select Express Web-GIS Install and click next. In the 'Select Packages' list, ensure that GDAL is selected. If any other packages are enabled by default, they are not required by GeoDjango and may be unchecked safely. After clicking next and accepting the license agreements, the packages will be automatically downloaded and installed, after which you may exit the installer.

Athraigh timpeallacht WindowsLink to this heading

In order to use GeoDjango, you will need to add your OSGeo4W directories to your Windows system Path, as well as create GDAL_DATA and PROJ_LIB environment variables. The following set of commands, executable with cmd.exe, will set this up. Restart your device once this is complete for new environment variables to be recognized:

Bat
set OSGEO4W_ROOT=C:\OSGeo4W
set GDAL_DATA=%OSGEO4W_ROOT%\apps\gdal\share\gdal
set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
set PATH=%PATH%;%OSGEO4W_ROOT%\bin
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /f /d "%PATH%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v GDAL_DATA /t REG_EXPAND_SZ /f /d "%GDAL_DATA%"
reg ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROJ_LIB /t REG_EXPAND_SZ /f /d "%PROJ_LIB%"

Suiteáil Django agus bunachar sonraí a bhunúLink to this heading

Install Django on your system. It is recommended that you create a virtual environment for each project you create.

PsychopgLink to this heading

Soláthraíonn modúl Python psycopg an comhéadan idir Python agus bunachar sonraí PostgreSQL. Is féidir psycopg` a shuiteáil trí phip laistigh de do thimpeallacht fhíorúil Python:

Windows
...\> py -m pip install psycopg

Fonótaí