Open main menu

Gramps β

Changes

GEPS 013: Gramps Webapp

4,629 bytes added, 17:39, 1 December 2023
m
no edit summary
{{man warn|WebApp has been superseded|This [[GEPS_013:_Gramps_Webapp|GEPS]] page is part of an obsolete discussion of a Gramps web app and has been superseded by [[Addon:Gramps_Web|Gramps Web]], a server-based variant of Gramps was released in late 2022.<br />[[Gramps_Server_Mode|'''Gramps Server Mode''']] is also obsolete. It is replaced by the [https://github.com/gramps-project/gramps-webapi/ Gramps Web API] in March 2023.<br />The architecture is very different than specified in this GEPS. One important difference is that the server code and the user interface code are separated, rather than both implemented in Django.}}
 
Many Gramps users would like to collaborate or share their genealogy data on the web. This GEP describes a webapp, a web-based application that runs in your browser, and requires a server.
 
A prototype was on-line from Nov.2009 to Sept.2016 at http://gramps-connect.org/{{Dead link|url=http://gramps-connect.org/}} which was running trunk on a sample database. You could log into the site, as a:
*superuser (id=admin, password=gramps) or a
*regular user (id=admin1, password=gramps)
or just view as an anonymous user.
 
There are two additional pages on this project:
 
* [[Gramps-Connect]] - getting started
* [[Gramps-Connect: Developer Introduction]] - introduction for developers
== Motivation ==
Here is a small list of goals:
# Create a fullscale GRAMPS Gramps web framework
# Allow multiple users via the standard web browser
## Users will log in and have various levels of permissions
# Build on GRAMPS Gramps codebase and wealth of resources
## Reports
## Tools
# Users have grown to appreciate the design of Gramps, and we want to continue to build on this design.
# Many users want to collaborate. Currently, they would either have to move their data in and out of Gramps, or give up Gramps completely.
# We want to keep the developers and users that we have, and so not splinter our groups. By linking building the webapp on top of core gramps code, we continue to refine and make better our current code, and keep our current developers working on the parts that they know and love.
2. ''Why do you need a web framework like Django? Can't you just use the same Python code, and same database that Gramps already uses?''
4. ''When is this going to be available?''
We are hoping to have a fully functioning webapp ready for testing December 2009July 2010.
5. ''How can I help?''
=== Models/Views ===
Here is the model that defines the Person table from [http:{{Code Base}}gramps/webapp/grampsdb/models.py gramps/webapp/grampsdb/models.svnpy] ([https://github.sourceforge.netcom/viewvcgramps-project/gramps/branchesblob/gepsmaintenance/gep-013-servergramps40/src/gengramps/webwebapp/grampsdb/models.py?view=markup srcmaintenance/gramps40/gengramps/webwebapp/grampsdb/models.py/]:
<pre>
</pre>
Here, you can see that Person only has 4 parts: gender_type, families, parent_families, and references. There are are additional properties, but they are defined in the PrimaryObject class which is shared with other tables. Here is PrimaryObject:
<pre>
<pre>
% cd trunk % PYTHONPATH=src DJANGO_SETTINGS_MODEL=webapp.settings python >>> selffrom webapp.grampsdb.models import Person >>> Person.objects.all()
[<Person>, <Person>, ...]
>>> selfPerson.Personobjects.get(id=1)
<Person>
>>> selfPerson.Personobjects.get(handle='gh71234dhf3746347734')
<Person>
</pre>
The first retrieves all of the rows for the Person table; the second retrieves just the one record that has the unique, primary key 1, and the third retrieves the single record that has the unique handle of 'gh71234dhf3746347734'.Note that we never connected onto a database... Django is (currently) define to connect on to one database, and it does it on import. The database is set in gramps/webapp/settings.py. An alternative method of interactively talking to the database is to use ''manage.py'': <pre> % cd master/gramps/webapp % PYTHONPATH=../../gramps python manage.py shell >>></pre> That will give you an ipython shell, if you have it installed. Very nice environment!
You can also use the Person interface to select a subset of people:
<pre>
>>> selffrom webapp.grampsdb.models import * >>> Person.objects.filter(gender_type=1)
[<Person>, <Person>, ...]
</pre>
 
or even more clearly:
 
<pre>
>>> Person.objects.filter(gender_type__name="Male")
[<Person>, <Person>, ...]
</pre>
 
The double-underscore in the keyword "gender_type__name" of the filter method is a Django convention. It means "replace with the correct syntax". If Python allowed it, it would be written as '''Person.objects.filter(gender_type.name="Male")''' but that is not legal syntax.
 
==== Model overview ====
Here is an overview of all of the models and how they are related:
 
[[File:All-tables.png]]
 
 
{{man tip| 1=To update this (Gramps 3.x and earlier) |2=To see more graphical representations of the data, run "make docs" in the src/webapp/ directory, and then look in src/webapp/docs/.}}
 
* [https://gramps-project.org/docs/gen/gen_db.html#dbdjango Gramps DbDjango]
=== Templates ===
Templates are used to describe ''what'' to display. Here is a template from [http://gramps.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-server/src/{{Code Base}}data/templates/main_page.html?view=markup src/data/templates/main_page.html]:
<pre>
=== Getting Started with Gramps in Django ===
A prototype of a GRAMPS Gramps Django webapp is now in branches/geps/gep-013-servertrunk and gramps32. To run it, do the following:
# Download Django. You'll need version 1.13 or greater
## On yum-based systems, try "yum install Django"
# Checkout the branches/geps/gep# On apt-based systems, try "sudo apt-013get install python-server from SVNdjango"## cd gramps## svn co httpsOther systems: get the sources from http://gramps.svnwww.sourceforgedjangoproject.net/svnroot/gramps/branchescom/gepsdownload/gep-013-server## This will create a subdirectory here called ''gep-013-server''clone the Git repository and checkout either the gramps32 or master branch # cd gep-013-server/src/gen/web/# Edit settings.py## Edit the path to the Sqlite DB (or use another if you wish, including Oracle, MySQL, Postgresql, etc.)# Create Build the tablesdatabase, and fill load with core default data:## make clean
## make
## This will ask for an id, email, and password for a superuser. You can add one later if you don't do it now.
# Run the test webserver:
## make run
At this point, you can now export your Gramps data to Django (and back). In another terminal window:
# Build this version of GrampsStart up gramps:## cd gep-013-server../## ./autogen.sh# Start up this version of Gramps
## python src/gramps.py
# Download the Django Import/Export Addon from [[3.3_Addons]]
# Run the Django Exporter
## Select Family Tree -> Export
## Select Django
This will export your regular Gramps BSDDB data into whatever Django database you have defined in settings.py above. You now have your data in a sqlite SQL database, and can access it via the webbrowser.
To import data back from Django's SQL table back into Gramps from the website:
# Create a file named "import.django" somewhere (just needs to end in ".django").
# Start up this version of Gramps
## python src/gramps.py
# Run the Django Importer
## Select Family Tree -> Import [[Image:DjangoImportExport.jpg|thumb|right|150px]]
## Select the "import.django" (from above) as the file to import
 
To add a superuser (after the initialization):
 
# cd src/web
# PYTHONPATH=../../src python manage.py createsuperuser
For more on Django, try their tutorial:
There are two subdirectories and two files of interest to the Gramps webapp:
# http://gramps.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-server/src/{{Code Base}}data/templates/ - HTML templates# http://gramps.svn.sourceforge.net/viewvc/{{Code Base}}gramps/branches/geps/gep-013-server/src/gen/webwebapp/ - Webapp main directory## http://{{Code Base}}gramps.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-server/src/gen/webwebapp/libdjango.py?view=markup - library interface## http://{{Code Base}}gramps.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-server/src/gen/webwebapp/grampsdb - gramps table models## http://gramps-addons.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-serveraddons/srctrunk/gencontrib/webDjango/views ExportDjango.py?view=markup - gramps views modelExporter# http://gramps-addons.svn.sourceforge.net/viewvc/gramps/branches/geps/gep-013-serveraddons/srctrunk/pluginscontrib/exportDjango/ExportDjangoImportDjango.py?view=markup - ExporterImporter == Roadmap == Phase 1: get the basic Django skeleton in place, including the core HTML templates, models, views, and templatetags. Should be able to browse the 8 primary tables. Get translations in place. Goal for version 0.1 to be announced with Gramps 3.2 in March 2010. # httpPhase 2:Be able to run all of the reports directly from the web with an option interface. Be able to import/export from the web. This will largely depend on a gen/db/dbdjango library. Goal for version 0.5beta, May 2010. Phase 3: add and edit data from the web. This would complete the functionality of the web interface. Goal July 2010. Phase 4: Refine and polish. Release with Gramps 3.3. If you would like to work on an area, please note it here: # Kathy - edits and adding new data# Doug - Integration with grampscore; browsing data# - Translation system# - Proxy interface to show Private data# - concurrent edits# - date widget# - running reports interface# - media files.svn.sourceforge.net/viewvc/gramps/branches/geps/gepwhere do they go?# -013options interface, for editing options to run report# -server/src/plugins/import/ImportDjangoGEDCOM from web# - full djangodb.py?view=markup to replicate all functions of bsddb# - Importeruser support (email, mailing lists, permissions, etc)
== Issues ==
=== Concurrent Edits ===
Concurrent access for write and read imply several problems when people by accident change the same objects at the same time. GRAMPS Gramps itself has an elaborate signal handling for cases when dialogs are open with no longer current information. In a web environment, this becomes more difficult however. This is not built into Django.
For discussion on this issue in Django, see:
** [http://groups.google.com/group/django-developers/browse_thread/thread/fd5d45fc6cd6a760 Developer discussion on topic]
[[Category:GEPS|S]]== Example GMS Web Sites ==
== Example GMS Web Sites ==We now have a example gramps webapp on the web: * http://gramps-connect.org/
Genealogy Management Systems on the web:
* http://www.dertinger.de/Dertinger_database/en/en_index.htm(Oxy-gen)* http://registry.phpgedview.net/index.php for example: [http://www.admiraal.org/]. (PhpGedView)
: Note here: the intro page is a collection of gadgets/controls, which then link into the real data.
* http://webtrees.net/demo/next (webtrees)
* http://beck.org.il/humogen/ (HuMogen)
* http://genealogies.geneamania.net/servin/ (Généamania)
* http://www.geneotree.com/geneotree/index.php (Geneotree)
* http://ancestorsnow.com/ancestors
* http://www.phpmyfamily.net/demo/
* http://www.frog.za.net/family/surname-list.php ([[Other_genealogy_tools#Gramps-php-exporter|gramps-php-exporter]])
 
Collaborative database (user/wizard/password):
 
* http://roglo.eu/roglo?lang=en (GeneWeb)
* http://gennus.org ([http://beta.gennus.org/en/page/about.html beta][http://beta.gennus.org/en/page/releasenotes.html])
* http://brozer.fr (alpha[http://www.innovup.com/evenement/124/89-actualites-agenda.htm])
 
Source oriented:
 
* http://solumslekt.org/forays/yggdrasil.php [http://code.google.com/p/yggdrasil-genealogy/][http://solumslekt.org/blog/]
 
==See also==
*[[Gramps-Connect: Introduction|gramps-connect]]
*[https://github.com/gramps-project/gramps-online Gramps Online]
[[Category:GEPS|SG]]
4,610
edits