<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Django in Neo4j Developer Blog on Medium]]></title>
        <description><![CDATA[Latest stories tagged with Django in Neo4j Developer Blog on Medium]]></description>
        <link>https://medium.com/neo4j/tagged/django?source=rss----c0e10f7c3cc0--django</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Django in Neo4j Developer Blog on Medium</title>
            <link>https://medium.com/neo4j/tagged/django?source=rss----c0e10f7c3cc0--django</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 19:00:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/neo4j/tagged/django" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <item>
            <title><![CDATA[Neomodel: Python OGM for Neo4j Extends Version Support and Moves to Neo4j Labs]]></title>
            <link>https://medium.com/neo4j/neomodel-python-ogm-for-neo4j-extends-version-support-and-moves-to-neo4j-labs-67fcab547eb4?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/67fcab547eb4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Marius Conjeaud]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 19:27:07 GMT</pubDate>
            <atom:updated>2023-08-30T18:08:42.600Z</atom:updated>
            <content:encoded><![CDATA[<h4>We’re excited to announce that neomodel, the Python OGM (Object-Graph Mapping) library, has officially moved to the Neo4j Labs program and now supports Neo4j version 5.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9-hGxYrGhyu3ZhNh3ZX_w.png" /></figure><p>This development brings a host of advantages and opportunities for both the neomodel community and Neo4j users alike. In this post, we’ll cover what value this brings to the library and implies for its future.</p><h3>A Community-Focused Library</h3><p>Neo4j Labs is a means for exploring new technologies with Neo4j with open-source projects. It focuses on projects that see interest and adoption and manages expectations and a minimum level of quality. Many important product developments had their origins in Neo4j Labs like graph data science, the GraphQL library, the Kafka and Spark integrations, and APOC core.</p><p><a href="https://neo4j.com/labs/">Neo4j Labs - Neo4j Labs</a></p><p>Like the other Neo4j Labs projects, neomodel remains an open-source, and completely community-driven library.</p><p>Joining the Neo4j Labs program implies the following:</p><ul><li><strong>Clear expectations:</strong> Labs projects are experimental and not officially product-supported, although some of them (like NeoDash, neosemantics, and neomodel) have available Neo4j Services packages for development and support.</li><li><strong>Quality standards:</strong> To be part of Labs, you need to adhere to certain minimal quality standards, which ensures enhanced code quality (unit and integration testing), security checks, automated tooling (CI/CD), etc…</li><li><strong>Releases and responsiveness:</strong> Labs projects must have regular releases, e.g., to support newer Neo4j versions and respond timely to issues and user questions. Neo4j involvement: At least one maintainer must be Neo4j employee.</li><li><strong>Collaboration and evolution:</strong> It provides the library with closer interactions with the Neo4j product and field teams. For example, it can benefit from learnings gained in the official OGMs for Java/Spring and GraphQL. Learnings from Labs projects will be integrated into future product development.</li><li><strong>Real-world usage and interest:</strong> In the case of neomodel, this also happened because neomodel is being used in production by Neo4j Services customers with special requirements — see author disclaimer at the end of this article for an example.</li></ul><p>You can find all the <a href="https://neo4j.com/labs/">Neo4j Labs projects</a> and the <a href="https://neo4j.com/labs/neomodel/">Neomodel pages</a> on the website.</p><p><a href="https://neo4j.com/labs/neomodel/">neomodel - Python OGM for Neo4j - Neo4j Labs</a></p><h3>Now Fully Supporting All Current Versions of Python and Neo4j</h3><p>Since neomodel got back into active maintenance mode in early 2023, the main focus has been to improve tooling (above all integration tests) to ensure robustness, confidence, and version support. The maintainence team is now pleased to announce that neomodel fully supports all supported versions of Python and Neo4j — both Community and Enterprise — as seen in the <a href="https://github.com/neo4j-contrib/neomodel/blob/master/.github/workflows/integration-tests.yml">Integration tests matrix in GitHub Actions</a>.</p><ul><li>Latest <a href="https://pypi.org/project/neomodel/">neomodel release</a></li><li>Latest <a href="https://pypi.org/project/django-neomodel/">Django-neomodel release</a></li></ul><h3>Future Evolutions</h3><p>Stay updated on neomodel’s future evolutions, and please join the discussions on its GitHub repository :</p><ul><li>The <a href="https://github.com/neo4j-contrib/neomodel/issues">Issues log</a> is being monitored again — to the extent that time allows, and we are trying to summarize and clean up the old issues.</li><li>The <a href="https://github.com/neo4j-contrib/neomodel/discussions">Discussions page</a> is open to anyone and will contain announcements.</li></ul><h3>What Is Neomodel and How Does It Work?</h3><p>We intend to release new, updated content around the library. But until we can work this out, please see the following content written for previous versions of the library — the sample projects mentioned in these articles have been kept up to date :</p><ul><li><a href="https://github.com/neo4j-examples/neo4j-movies-python-neomodel/blob/main/movies/views.py">Simple example</a></li><li><a href="https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e">Neo4j for Django developers</a></li><li><a href="https://2023.djangocon.us/talks/working-with-neo4j-with-djando-neomodel-library/">Talk at upcoming DjangoCon</a></li><li><a href="https://neomodel.readthedocs.io/en/latest/">Documentation</a></li></ul><p>For more insights and discussions, join the neomodel community on GitHub and stay tuned to the latest developments.</p><p>Looking forward to your feedback, Marius</p><p><em>Disclaimer: About the Author and their Role — and how neomodel benefits from field experience.</em></p><p><em>The author of this article is a member of Neo4j’s Professional Services team, dedicated to assisting customers in successfully deploying Neo4j projects into production environments. A good example of an impactful, production-type project using neomodel is </em><a href="https://openstudybuilder.com/"><em>OpenStudyBuilder</em></a><em>, driven by Novo Nordisk. OpenStudyBuilder showcases the practical application of neomodel within real-world projects and also provides specific requirements, which in turn become new features for the community thanks to Neo4j’s Services team merging it back into the library. It is also a great example of an Enterprise organization leveraging and donating back to open source, but that would deserve a whole article.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67fcab547eb4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/neomodel-python-ogm-for-neo4j-extends-version-support-and-moves-to-neo4j-labs-67fcab547eb4">Neomodel: Python OGM for Neo4j Extends Version Support and Moves to Neo4j Labs</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Orai: Project Planning with Neo4j]]></title>
            <link>https://medium.com/neo4j/orai-project-planning-with-neo4j-eca26ecab56f?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/eca26ecab56f</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[process-improvement]]></category>
            <dc:creator><![CDATA[Cristina]]></dc:creator>
            <pubDate>Thu, 06 Jan 2022 22:08:37 GMT</pubDate>
            <atom:updated>2022-01-06T22:08:37.345Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A </em><strong><em>student project</em></strong><em> was developed though </em><a href="https://www.fau.edu/engineering/senior-design/"><em>Florida Atlantic University’s Senior Design Program</em></a><em> by student team </em><strong><em>Logic13</em></strong><em>.</em></p><h3>Background</h3><p><strong><em>Sprint cycles</em></strong> are an extremely common way for development teams to plan and execute the development of projects. This agile method can be used by a variety of different development teams. Working in sprint cycles allows teams to get fast feedback, improve their product’s quality, reduce risk, and it makes it easier to stay on schedule.</p><h3>The Problem</h3><p>Project Managers must work carefully to make sure the sprint cycles can flow as best as possible with <strong><em>minimal stagnation</em></strong>. To do so, Project Managers set aside time for sprint planning where they can create a road map of what tasks need to be done in what order so that the project can progress and be completed. This can be especially difficult to accomplish since some tasks can be more important or more complicated than others or <strong><em>rely on the completion</em></strong> of other tasks before they may be worked on.</p><h3>The Solution</h3><p><a href="https://github.com/Group13-FAU/Orai">The Orai application</a> is a recommendation engine built around project management data. It combines the querying power of the<a href="https://neo4j.com/"> Neo4j graph database</a> with the flexibility of the<a href="https://www.djangoproject.com/"> Django web framework</a> using the<a href="https://github.com/neo4j-contrib/django-neomodel"> django-neomodel plugin</a>.</p><p><a href="https://github.com/Group13-FAU/Orai">GitHub - Group13-FAU/Orai</a></p><p>The Orai system monitors all tasks dependent on each other and builds sprints from them with the highest priority tasks getting scheduled first. The length of these sprints is based on each tasks’ complexity, allowing the user to gain more control of how much the development team can handle.</p><p>Furthermore, the user can control the number of sprints, the complexity of sprints, the essential tasks, and the number of essential tasks that can be worked on per sprint.</p><h3>Implementation Details</h3><p>Orai takes in four user inputs:</p><ul><li>The max complexity value of each sprint</li><li>Minimum number of sprints desired</li><li>(Optional) The maximum length of the dependency tree</li><li>A set of Storys to be prioritized</li></ul><p><a href="https://github.com/Group13-FAU/Orai/blob/master/fetch_api/models/story.py">The Story Model and Relationships</a> are extremely lightweight — the application uses only Story nodes and a REQUIRES relationship between Storys:</p><pre>from neomodel import (<br>    StringProperty,<br>    StructuredNode,<br>    RelationshipTo,<br>    IntegerProperty,<br>    FloatProperty,<br>    BooleanProperty<br>)<br><br><br>class Story(StructuredNode):<br>    # Properties<br>    nodeID = IntegerProperty(index=True, db_property=&#39;id&#39;)<br>    sentimentScore = StringProperty()<br>    sentiment = StringProperty()<br>    notes = StringProperty()<br>    name = StringProperty()<br>    value = StringProperty()<br>    acceptance_criteria = StringProperty()<br>    complexity = IntegerProperty()<br>    priority = FloatProperty()<br>    approved = BooleanProperty()<br><br>    # Relationships<br>    requires = RelationshipTo(&#39;.story.Story&#39;, &#39;REQUIRES&#39;)</pre><p>The project used a dataset from <a href="https://tsl.io/">The SilverLogic</a>’s internal project management system.</p><pre>MATCH p=(:Story)-[:REQUIRES]-&gt;(:Story)<br>RETURN p<br>LIMIT 10</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xp77LDrwYEElkE4AIoEvbQ.png" /><figcaption>Selection of Story Nodes from the Dataset</figcaption></figure><p>In the example output above, if a team wanted to prioritize the implementation of the Invoice Picker story, they would have to first complete the Share text and No Stories Empty State stories, as they are prerequisites.</p><p>Given enough team members and a long-enough sprint, it might be possible to work on Share text and No Stories Empty State in parallel, and immediately move to Invoice Picker once both tasks are completed. If the team knows roughly how many complexity points they can complete in one sprint — and have thoughtfully given their best estimates to the stories in the backlog — having a planning tool that can provide example roadmaps that take into account inter-story relationships can be a useful starting point for planning and scheduling.</p><h4>Example Input Form</h4><figure><img alt="Input form for the project planning and dependency management software, Orai" src="https://cdn-images-1.medium.com/max/1024/1*gU4Ipk5z6Bqu0zk5EnNKdA.png" /><figcaption>Example Input Form</figcaption></figure><p>Imagine selecting the following parameters:</p><p>Max complexity value per sprint: 12</p><p>Minimum number of sprints: 3</p><p>Priority Story :</p><ul><li>Epic / Actor / Platform Archiving</li><li>Harvest Integration V2 Phase 4 Time Entry Augmentation</li><li>Invoice Time Entry Moving</li></ul><h3>Example Output</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pIlGvKESzCA4oQtMtbN8FQ.png" /><figcaption>Example Output</figcaption></figure><p>The above is an example of a sprint cycle. The required stories are organized such that the stories it depends on are scheduled before it. For example, Sub Epics requires that Invoice Time Entry Moving be completed first.</p><h3>Conclusion and Retrospective</h3><p>Over the course of two semesters, Logic13 was able to successfully design and implement a low-cost solution to the project sponsor’s (<a href="https://tsl.io/">The SilverLogic</a>) requested problem.</p><p>Our project, <a href="https://github.com/Group13-FAU/Orai">Orai</a>, is a user-friendly system that can generate optimal sprint cycles from user inputs and display them along with informative details about the sprints and the tasks.</p><p>The team was able to learn new programming and computer skills, such as working with and collaborating through GitHub. The team also learned about software development and how to help customers with their requests by giving them alternatives and explanations.</p><p>If we had the opportunity to start over and do it again, we’d make a few improvements. One is that on the suggestion page where the user inputs the information, we would add more information to the list of tasks to make it easier for the user to make a choice. This would make the system easier and more convenient to use for the user. Besides that, the team believes this solution is the most optimal and efficient way to schedule tasks for sprints. We are very proud of the work put into the development of the system.</p><h3>Team Logic13</h3><p>Team Logic13 (pictured below) consisted of very talented individuals that came together to develop a great system. <strong>Felix Medrano</strong> took on the role of project lead and handled project scheduling and synchronization, as well as communicating with the sponsor.</p><p>Because of his experience with web development and algorithms he would develop the scheduling algorithm used for Orai as well as develop the front end. <strong>Valentina Diaz</strong>, also having experience with the algorithms we would need, oversaw the chart development and helped with documentation. Because of his experience in the field, <strong>Jacob Christensen</strong> oversaw the back end and the development of the foundation for the project, including database and system management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*RL7pGFhgelz0LIEFDVILtg.png" /><figcaption>Team Logic13</figcaption></figure><h3>Further Resources</h3><ul><li><a href="https://www.fau.edu/engineering/senior-design/projects/fall2021/">Fall 2021 Showcase</a></li><li><a href="https://github.com/neo4j-examples/paradise-papers-django">GitHub - neo4j-examples/paradise-papers-django: A simple Django web app for searching the Paradise Papers dataset backed by Neo4j</a></li><li><a href="https://www.fau.edu/engineering/senior-design/future-sponsors/">Future Sponsors</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eca26ecab56f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/orai-project-planning-with-neo4j-eca26ecab56f">Orai: Project Planning with Neo4j</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resotrack: Exploring the Resonate API with Django-Neomodel on Aura]]></title>
            <link>https://medium.com/neo4j/resotrack-exploring-the-resonate-api-with-django-neomodel-on-aura-da0eef97e65a?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/da0eef97e65a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[platform-cooperativism]]></category>
            <category><![CDATA[graph-database]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Cristina]]></dc:creator>
            <pubDate>Fri, 13 Aug 2021 14:48:19 GMT</pubDate>
            <atom:updated>2021-08-13T14:48:34.942Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Resotrack</strong> (<a href="https://resotrack.herokuapp.com/">demo</a>, <a href="https://github.com/whatSocks/reso-tag-charts">code</a>) uses Neo4j to suggest popular, relevant tracks from <a href="https://resonate.is/">Resonate</a>’s music catalog</h4><p>Resonate is a relatively young, (almost all) <a href="https://github.com/resonatecoop">open source</a> music streaming platform with a catalog featuring mostly but not exclusively ambient and electronic music, as categorized by Tags at the album level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nzQMEGH4lI7G3FVR" /><figcaption>Photo by <a href="https://unsplash.com/@leecampbell?utm_source=medium&amp;utm_medium=referral">Lee Campbell</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While many users enjoy exploring in random mode, listeners interested in learning more about the seemingly endless subgenres within Resonate would benefit from having a simple recommendation tool to find the most popular tracks for each tag.</p><p>In an attempt to provide a solution to this discovery issue, Resotrack (<a href="https://resotrack.herokuapp.com/">demo</a>, <a href="https://github.com/whatSocks/reso-tag-charts">code</a>) uses Neo4j to suggest popular, relevant tracks for each tag in <a href="https://resonate.is/">Resonate</a>’s music catalog.</p><p><a href="https://resonate.is/">Resonate - the ethical music streaming co-op</a></p><p>Resotrack also happens to be built using <a href="https://github.com/neo4j-contrib/django-neomodel">Django-Neomodel</a> and deployed on Aura Free and Heroku. This example will present a brief overview of the project and provide simple examples of apoc.periodic.commit and importing JSON Data from a REST API into Neo4j using apoc.load.json.</p><h3>The Resotrack Data Model</h3><figure><img alt="Resotrack’s data model" src="https://cdn-images-1.medium.com/max/717/0*tRGVDN-3XAnsEcNM" /><figcaption>Resotrack’s base data model</figcaption></figure><p>While the creators of the tracks can add their tracks to a variety of types of TrackGroups (lp, eps, et cetera) and add Tags to these TrackGroups, non-artists can add tracks to TrackGroups of type playlist, and have limited (or no) tagging capabilities.</p><figure><img alt="Resotrack data model, with tags" src="https://cdn-images-1.medium.com/max/479/0*hDPkiTDY1TnWIKBG" /><figcaption>Resotrack’s data model, with tags</figcaption></figure><p>As Resotrack users search and interact with the data, the system calculates a “Top Track” for each tag and presents the “Top Track” for a particular tag to the user.</p><h3>Using Resotrack</h3><p>In the example below, the user has searched for techno and is presented with the top track for tags containing the string techno. In the image below, since ambienttechno has techno as a substring, we can see that <a href="https://beta.stream.resonate.coop/track/22439">Daibutsu</a> is the TOP_TRACK for the Tag ambientechno.</p><figure><img alt="Resotrack UI" src="https://cdn-images-1.medium.com/max/1024/0*OOiL6RsPcO1OWSMW" /><figcaption>Resotrack’s Frontend</figcaption></figure><p>In the Django admin, the superuser can view the project’s R(esonate) Users, Tags, Track groups, and Tracks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hx_ecBLo8-8JspBR" /><figcaption>Resotrack’s Admin</figcaption></figure><h3>Connecting the Django-Neomodel App to Aura Free</h3><p>If you haven’t already, <a href="https://github.com/whatSocks/reso-tag-charts">clone the repo to your local machine</a>:</p><pre>git clone <a href="mailto:git@github.com">git@github.com</a>:whatSocks/reso-tag-charts.git</pre><p><a href="https://github.com/whatSocks/reso-tag-charts">GitHub - whatSocks/reso-tag-charts: Example Movie app for Neo4j and Django</a></p><p><a href="https://console.neo4j.io">Create or log in to your Aura account</a></p><p><a href="https://neo4j.com/aura">Neo4j Aura - Fully Managed Cloud Solution</a></p><p>Tap <strong>Create a database</strong> then select <strong>Aura Free</strong>.</p><p>Follow the prompts to create the database and take note of the username (neo4j) and password.</p><p>Log in to the neo4j browser and verify the database exists with the “Open” button.</p><p>In your terminal, navigate to the project’s root directory and create the database environment variable:</p><p>export NEO4J_BOLT_URL=neo4j+s://neo4j:password@host-or-ip:port</p><p>Run migrations and create your superuser (for the admin, this is using an SQLite database)</p><pre>./manage.py migrate<br>./manage.py createsuperuser</pre><p>Run the server:</p><pre>python manage.py runserver</pre><p>Now you should be able to access <a href="http://localhost:8000">http://localhost:8000</a> and view the empty app.</p><h3>Load the Data</h3><p>An empty database is no fun. We can use apoc.load.json (<a href="https://neo4j.com/developer/guide-import-json-rest-api/">Strava example</a>) and <a href="https://neo4j.com/labs/apoc/4.3/overview/apoc.periodic/apoc.periodic.commit/">apoc.periodic.commit</a> to load the data from the Resonate API.</p><p><a href="https://neo4j.com/developer/guide-import-json-rest-api/">Importing JSON Data from a REST API into Neo4j - Developer Guides</a></p><p>You can easily <a href="https://resonate.is/join/">create a Listener account on Resonate</a> and create your own playlists before you start. While not required, accounts are <strong>free</strong> and are helpful in understanding the lay of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-p1r968RmAp5IJSH" /></figure><h4><strong>Create Constraints</strong></h4><pre>CREATE CONSTRAINT ON (a:Ruser) ASSERT a.uuid IS UNIQUE;<br>CREATE CONSTRAINT ON (a:TrackGroup) ASSERT a.uuid IS UNIQUE;<br>CREATE CONSTRAINT ON (a:Track) ASSERT a.uuid IS UNIQUE;</pre><h4><strong>Add the first page of Playlists (a type of TrackGroup)</strong></h4><pre>WITH &#39;https://api.resonate.coop/v2/&#39; AS uri<br>CALL apoc.load.json(uri + ‘trackgroups?type=playlist’) // in this example, grabbing listener-generated playlists<br>YIELD value<br>UNWIND value[“data”] as data<br>MERGE (u:RUser {uuid:toString(data[&#39;user&#39;][&#39;id&#39;])})<br>MERGE (t:TrackGroup {uuid:toString(data[&#39;id&#39;])})<br>MERGE (u)-[:OWNS]-&gt;(t)<br>SET t.title = data[&#39;title&#39;]<br>SET t.type = data[&#39;type&#39;]<br>SET t.slug = data[&#39;slug&#39;]<br>SET t.tracks_imported = false</pre><p><strong>Add more TrackGroups</strong></p><pre>WITH &#39;https://api.resonate.coop/v2/&#39; AS uri<br>CALL apoc.load.json(uri + ‘trackgroups’) // in this example, grabbing listener-generated playlists<br>YIELD value<br>UNWIND value[“data”] as data<br>MERGE (u:RUser {uuid:toString(data[&#39;user&#39;][&#39;id&#39;])})<br>MERGE (t:TrackGroup {uuid:toString(data[&#39;id&#39;])})<br>MERGE (u)-[:OWNS]-&gt;(t)<br>SET t.title = data[&#39;title&#39;]<br>SET t.type = data[&#39;type”]<br>SET t.slug = data[&#39;slug]<br>SET t.tracks_imported = false</pre><h4><strong>Add Tracks</strong></h4><pre>CALL apoc.periodic.commit(<br>&quot;MATCH (tg:TrackGroup)<br>WHERE NOT tg.tracks_imported<br>SET tg.tracks_imported = true<br>WITH tg limit $limit<br>WITH &#39;https://api.resonate.coop/v2/&#39; AS uri, tg.uuid as tg_id<br>CALL apoc.load.json(uri + &#39;trackgroups/&#39; + tg_id )<br>YIELD value<br>UNWIND value[&#39;data&#39;][&#39;items&#39;] as items<br>MERGE (u:RUser {uuid:toString(items[&#39;track&#39;][&#39;creator_id&#39;])})<br>MERGE (track:Track {uuid:toString(items[&#39;track&#39;][&#39;id&#39;])})<br>MERGE (t)-[:HAS_TRACK]-&gt;(track)<br>MERGE (track)&lt;-[:CREATED]-(u)<br>SET track.title = items[&#39;track&#39;][&#39;title&#39;]<br>SET track.tags_imported = false<br>RETURN count(*)&quot;,</pre><pre>{limit:10});</pre><p><strong>Add Tags</strong></p><pre>CALL apoc.periodic.commit(<br>&quot;<br>MATCH (u:RUser)-[:CREATED]-&gt;(track:Track)<br>WHERE not u.uuid in [&#39;7212&#39;,&#39;4315&#39;,’4414&#39;] // bad data<br>AND NOT track.tags_imported<br>SET track.tags_imported = true<br>WITH u as artist, u.uuid as user_id, count(DISTINCT track) as tracks,&#39;https://api.resonate.coop/v2/&#39; as uri<br>ORDER BY tracks desc<br>LIMIT $limit<br>CALL apoc.load.json(uri + &#39;artists/&#39; + user_id + &#39;/releases&#39;) // grabbing all<br>YIELD value<br>UNWIND value[&#39;data&#39;] as data<br>UNWIND data[&#39;tags&#39;] as tags<br>MERGE (t:TrackGroup {uuid:toString(data[&#39;id&#39;])})<br>MERGE (user:RUser {uuid:toString(user_id)})-[:OWNS]-&gt;(t)<br>MERGE (tag:Tag {name:toLower(tags)})<br>MERGE (tag)&lt;-[:HAS_TAG]-(t)<br>SET tag.uuid=apoc.create.uuid()<br>SET t.title = data[&#39;title&#39;]<br>SET t.type = data[&#39;type&#39;]<br>RETURN count(*)<br>&quot;,<br>{limit:10});</pre><p>Now you should be able to explore the data locally, with your data safe and sound in Aura.</p><h3><strong>About the Authors</strong></h3><p>Cristina and Alisson work at <a href="https://tsl.io/">The SilverLogic,</a> a software development company based in Boca Raton.</p><h3>Learn More</h3><ul><li><a href="https://neo4j.com/labs/apoc/4.3/overview/apoc.periodic/apoc.periodic.commit/">apoc.periodic.commit - APOC Documentation</a></li><li><a href="https://neo4j.com/developer/guide-import-json-rest-api/">Importing JSON Data from a REST API into Neo4j - Developer Guides</a></li><li><a href="https://neo4j.com/labs/apoc/4.1/import/load-json/">Load JSON - APOC Documentation</a></li><li><a href="https://resonate.is">Resonate - the ethical music streaming co-op</a></li><li><a href="https://github.com/whatSocks/reso-tag-charts">GitHub - whatSocks/reso-tag-charts: Example Movie app for Neo4j and Django</a></li><li><a href="https://neo4j.com/docs/aura/current/">Neo4j Aura - Neo4j Aura</a></li><li><a href="https://thobalose.co.za/2016/neomodel/#">Getting Started with Neomodel</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da0eef97e65a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/resotrack-exploring-the-resonate-api-with-django-neomodel-on-aura-da0eef97e65a">Resotrack: Exploring the Resonate API with Django-Neomodel on Aura</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Register Your Neo4j-Based Models to the Django Admin]]></title>
            <link>https://medium.com/neo4j/register-your-neo4j-based-models-to-the-django-admin-b58ebcd6dfc3?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/b58ebcd6dfc3</guid>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[crud]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[how-to]]></category>
            <dc:creator><![CDATA[Cristina]]></dc:creator>
            <pubDate>Fri, 09 Jul 2021 19:50:00 GMT</pubDate>
            <atom:updated>2021-07-09T19:50:00.626Z</atom:updated>
            <content:encoded><![CDATA[<h3>Register Your Neo4j-Based Models to Django Admin</h3><h4>A Paradise Papers Example</h4><p>If you’re a Django developer, you may have already found the popular <a href="https://py2neo.org">py2neo</a> toolkit and may have some experience using <a href="https://github.com/neo4j-contrib/neomodel">Neomodel</a> and/or the <a href="https://neo4j.com/docs/api/python-driver/current/">Neo4j python driver directly</a>. <strong>But how well do these tools play with Django?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*BLX4PmVOwwkUoGVtUCOm9Q.jpeg" /></figure><p>Thankfully for Django developers, the Neo4j ecosystem provides a quick way to spin up an example app — <a href="https://github.com/neo4j-examples/paradise-papers-django">the Paradise Papers Search App</a> — based on the <a href="https://www.icij.org/tags/paradise-papers/">Paradise Papers</a> dataset, conveniently available on <a href="https://sandbox.neo4j.com">Neo4j Sandbox</a>.</p><p>This post will be a quick walkthrough of how to register a model on the Paradise Papers Search app. For more details, check out our previous post on the topic here:</p><p><a href="https://neo4j.com/developer-blog/neo4j-for-django-developers/">Neo4j for Django Developers</a></p><h3>Local Setup — Sandbox Database</h3><p>First step, set up your local environment:</p><p><a href="https://github.com/neo4j-examples/paradise-papers-django">clone the repo</a>:</p><p>git clone git@github.com:neo4j-examples/paradise-papers-django.git</p><p>In a <a href="https://docs.python.org/3/tutorial/venv.html">virtual environment</a>, install the requirements:</p><p>pip install -r requirements.txt</p><p>Next you’ll need to point your app to a sandbox instance of the database.</p><p>In <a href="http://sandbox.neo4j.com/?usecase=icij-paradise-papers">Neo4j Sandbox</a>, create an account and select <em>Paradise Papers by ICIJ.</em></p><p>Back in the Sandbox UI, tap “Connection details” to find the database’s Bolt URL, username, and password.</p><figure><a href="http://sandbox.neo4j.com/?usecase=icij-paradise-papers"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GP-kllc60bU3BqUi" /></a></figure><p>In your local environment, set the DATABASE_URL variable using the credentials found in the Sandbox admin:</p><p>export DATABASE_URL=bolt://&lt;Username&gt;:&lt;Password&gt;@&lt;IP Address&gt;:7687</p><p>In paradise_papers_search/fetch_api/admin, add the models you would like to explore using the admin:</p><pre>from django.contrib import admin as dj_admin<br>from django_neomodel import admin as neo_admin</pre><pre>from .models import Entity</pre><pre>class EntityAdmin(dj_admin.ModelAdmin):<br>    list_display = (“name”,)</pre><pre>neo_admin.register(Entity, EntityAdmin)</pre><p>Add the admin URL to urls.py (if you haven’t done so already):</p><pre>from django.conf.urls import url, include<br>from django.views.generic import TemplateView<br>from django.contrib import admin</pre><pre>urlpatterns = [<br>    url(r&#39;^$&#39;, TemplateView.as_view(template_name=&#39;index.html&#39;), name=&#39;index&#39;),<br>    url(r&#39;^fetch/&#39;, include(&#39;fetch_api.urls&#39;)),<br>    url(r&quot;^admin/&quot;, admin.site.urls)<br>]</pre><p>Because Django’s admin authentication still goes through Django models, you will you need to set up a (relational) user database in your settings file and run the migrations.</p><p>Example settings snippet:</p><pre>DATABASES = {<br>    &#39;default&#39;: {<br>        &#39;NAME&#39;: &#39;papers.db&#39;,<br>        &#39;ENGINE&#39;: &#39;django.db.backends.sqlite3&#39;,<br>        &#39;USER&#39;: &#39;&#39;,<br>        &#39;PASSWORD&#39;: &#39;&#39;,<br>        &#39;PORT&#39;: &#39;&#39;,<br>    },<br>}</pre><p>Running the migrations:</p><pre>./manage.py migrate</pre><p>After that, create the admin superuser:</p><pre>./manage.py createsuperuser</pre><p>Run the app!</p><pre>python manage.py runserver — settings=paradise_papers_search.settings.dev</pre><p>Start searching at <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ox9MDtG4TPPagBMs" /></figure><p>Log in to the admin at <a href="http://127.0.0.1:8000/admin">http://127.0.0.1:8000/admin</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*qXs603_2RIlOd_3m61J78A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*QHYe0JYajJJquwEabh6YvA.png" /></figure><p>That’s it!</p><h3>Next Steps</h3><p>After testing out the ICIJ Panama Papers database, you may want to try using some of the data native to your Django application. Test out converting your relational dataset using the <a href="https://neo4j.com/labs/etl-tool/">Neo4j ETL Tool</a>:</p><p><a href="https://neo4j.com/labs/etl-tool/">Neo4j ETL Tool - Interactive Relational Database Data Import - Neo4j Labs</a></p><h3>Resources</h3><ul><li><a href="https://github.com/neo4j-contrib/neomodel">neo4j-contrib/neomodel</a></li><li><a href="https://github.com/neo4j-contrib/django-neomodel">neo4j-contrib/django-neomodel</a></li><li><a href="https://github.com/neo4j/neo4j-python-driver">neo4j/neo4j-python-driver</a></li></ul><p><em>Looking for more details on how Neo4j was used in the Panama Papers investigation? Check out more coverage here:</em></p><ul><li><a href="https://neo4j.com/blog/depth-graph-analysis-paradise-papers/">An In-Depth Graph Analysis of the Paradise Papers</a></li><li><a href="http://neo4j.com/blog/icij-neo4j-unravel-panama-papers/">How the ICIJ Used Neo4j to Unravel the Panama Papers</a></li><li><a href="http://neo4j.com/blog/analyzing-panama-papers-neo4j/">Analyzing the Panama Papers with Neo4j: Data Models, Queries &amp; More</a></li><li><a href="http://neo4j.com/blog/panama-papers/">The Panama Papers: Why It Couldn’t Have Happened Ten Years Ago</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b58ebcd6dfc3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/register-your-neo4j-based-models-to-the-django-admin-b58ebcd6dfc3">Register Your Neo4j-Based Models to the Django Admin</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Django-Neomodel Within a Docker Container]]></title>
            <link>https://medium.com/neo4j/running-django-neomodel-within-a-docker-container-f0d68c1d38c7?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/f0d68c1d38c7</guid>
            <category><![CDATA[django-framework]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[neo4j]]></category>
            <category><![CDATA[neo4j-ogm]]></category>
            <category><![CDATA[django-admin]]></category>
            <dc:creator><![CDATA[Cristina]]></dc:creator>
            <pubDate>Wed, 26 May 2021 12:39:32 GMT</pubDate>
            <atom:updated>2021-09-28T15:51:41.537Z</atom:updated>
            <content:encoded><![CDATA[<h4>Here’s your quickstart guide for posterity, using the example in Django-Neomodel.</h4><p>A Neomodel community member asked about how to run <a href="https://github.com/neo4j-contrib/django-neomodel">Django Neomodel</a> (a Neomodel plugin for Django) within a Docker container. So let’s show how to do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V8L-VmSgrWURW30x" /><figcaption>Photo by <a href="https://unsplash.com/@frankiefoto?utm_source=medium&amp;utm_medium=referral">frank mckenna</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Haven’t tried out Django-Neomodel yet? </em><a href="https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e"><em>Start here</em></a><em>.</em></p><p><a href="https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e">Neo4j for Django Developers</a></p><h3>Local Setup — Example</h3><p>Prerequisites:</p><ul><li>An updated version of <a href="https://www.docker.com/">Docker</a></li><li><a href="https://github.com/neo4j-contrib/django-neomodel">Django Neomodel</a></li></ul><p>The Django-Neomodel repository comes with a Docker example. If you’re just getting started with Docker, this may be a good place to start.</p><p>From the root of the Django-Neomodel repo, go to the tests directory:</p><pre>cd tests/</pre><p>Run the Docker Command (make sure your Docker service is running and up to date).</p><pre>docker-compose up</pre><p>Verify the Django admin is running: <a href="http://localhost:8000/admin/">http://localhost:8000/admin/</a></p><p>Verify Neo4j Browser is running: <a href="http://localhost:7474/browser/">http://localhost:7474/browser/</a></p><p>You’ll be then able to log in with the test credentials admin / 1234.</p><h3>Under the Hood</h3><h3>Dockerfile</h3><p>The <a href="https://github.com/neo4j-contrib/django-neomodel/blob/master/tests/Dockerfile">Dockerfile</a> collects the commands Docker will be using to create your environment.</p><pre>FROM python:3<br>WORKDIR /usr/src/app<br>COPY ./tests/requirements.txt ./<br>RUN pip install — no-cache-dir -r requirements.txt<br>COPY .. .<br>RUN chmod +x ./tests/docker-entrypoint.sh<br>CMD [“./tests/docker-entrypoint.sh” ]</pre><h3>docker-compose.yml</h3><p>docker-compose.yml is where you’ll configure the ports you’ll be using to communicate with your Neo4j database.</p><p><a href="https://github.com/neo4j-contrib/django-neomodel/blob/master/tests/docker-compose.yml">docker-compose.yml</a> :</p><pre>version: ‘3’<br>services:<br>    backend:<br>        build:<br>            context: ../<br>            dockerfile: ./tests/Dockerfile<br>        command: ‘/bin/bash -c “chmod +x /usr/src/app/tests/docker-entrypoint.sh &amp;&amp; /usr/src/app/tests/docker-entrypoint.sh”’<br>        volumes:<br>          - ..:/usr/src/app<br>        ports:<br>          - “8000:8000”<br>        expose:<br>          - 8000<br>        depends_on:<br>          - neo4j_db<br>        links:<br>          - neo4j_db<br>        environment:<br>          - NEO4J_BOLT_URL=bolt://neo4j:foobar@neo4j_db:7687<br>          - DJANGO_SETTINGS_MODULE=settings</pre><pre>neo4j_db:<br>        image: neo4j:4.2-enterprise<br>        ports:<br>          - “7474:7474”<br>          - “7687:7687”<br>        expose:<br>          - 7474<br>          - 7687<br>        volumes:<br>          - db:/data/dbms<br>        environment:<br>          - NEO4J_AUTH=neo4j/foobar<br>          - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes<br>          - dbms.connector.bolt.listen_address=:7687<br>          - dbms.connector.bolt.advertised_address=:7687</pre><pre>volumes:<br>    db:</pre><h3>docker-entrypoint.sh</h3><p>docker-entrypoint.sh is where you’ll configure the python/Django portion of your app. You’ll add your DJANGO_SUPERUSER_USERAME and other Django-related environment variables here.</p><p><a href="https://github.com/neo4j-contrib/django-neomodel/blob/master/tests/docker-entrypoint.sh">docker-entrypoint.sh</a> :</p><pre>#!/bin/bash -xe<br>cd tests<br>python -c &lt;&lt;EOF |<br>from django.db import IntegrityError<br>try:<br>    python manage.py install_labels<br>except IntegrityError:<br>    print(“Already installed”)<br>EOF</pre><pre>python manage.py migrate # Apply database migrations<br>if [ “$DJANGO_SUPERUSER_USERNAME” ]<br>then<br>    python manage.py createsuperuser \<br>        — noinput \<br>        — username $DJANGO_SUPERUSER_USERNAME \<br>        — email $DJANGO_SUPERUSER_EMAIL<br>fi</pre><pre>$@<br>python manage.py runserver 0.0.0.0:8000</pre><h3>Resources</h3><ul><li><a href="https://www.docker.com/">Docker: Accelerated Container Application Development</a></li><li><a href="https://www.djangoproject.com/">Django</a></li><li><a href="https://github.com/neo4j-contrib/neomodel/">neo4j-contrib/neomodel</a></li><li><a href="https://github.com/neo4j-contrib/django-neomodel">neo4j-contrib/django-neomodel</a></li><li><a href="https://github.com/neo4j-examples/paradise-papers-django">GitHub - neo4j-examples/paradise-papers-django: A simple Django web app for searching the Paradise Papers dataset backed by Neo4j</a></li><li><a href="https://stackoverflow.com/questions/64308828/docker-compose-db-connection-from-web-container-to-neo4j-container-using-bolt">Docker-compose: db connection from web container to neo4j container using bolt</a></li><li><a href="https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e">Neo4j for Django Developers</a></li></ul><h3>About the Authors</h3><p>Cristina and Alisson work at <a href="https://tsl.io/">The SilverLogic,</a> a software development company based in Boca Raton.</p><p>Alisson is a software engineer at <a href="https://tsl.io/">The SilverLogic</a>. Passionate about plants, he is the driving force behind <a href="https://queplanta.com/">Que Planta</a>, a GraphQL-based social network for plants.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0d68c1d38c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/running-django-neomodel-within-a-docker-container-f0d68c1d38c7">Running Django-Neomodel Within a Docker Container</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neo4j for Django Developers]]></title>
            <link>https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e?source=rss----c0e10f7c3cc0--django</link>
            <guid isPermaLink="false">https://medium.com/p/efd0e39e5f2e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[neo4j]]></category>
            <dc:creator><![CDATA[Cristina]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 14:07:13 GMT</pubDate>
            <atom:updated>2021-05-27T18:21:08.299Z</atom:updated>
            <content:encoded><![CDATA[<h4>From zero to deployment with Django-Neomodel and Neo4j’s Paradise Papers dataset.</h4><p>Making the leap from a relational database to a graph database for an existing project is not easy. Questions arise:</p><blockquote>What happens to the existing data? If the data is migrated, will the whole system have to be rewritten? What if we like our existing stack but still want the benefits of a graph database? Should we try a microservice? Will there be overhead? Will the overhead be worth it?</blockquote><p>Thankfully for Django developers, the Neo4j ecosystem provides a quick and painless way to spin up a test implementation</p><p>T<a href="https://github.com/neo4j-examples/paradise-papers-django">he Paradise Papers Search App</a>, based on the <em>Paradise Papers</em> dataset, is conveniently available on <a href="https://sandbox.neo4j.com">Neo4j Sandbox</a>. By following along with the steps of this post, you will be able to spin up a small Django application to explore the Paradise Papers dataset either locally or on Heroku.</p><p><a href="https://github.com/neo4j-examples/paradise-papers-django">GitHub - neo4j-examples/paradise-papers-django: A simple Django web app for searching the Paradise Papers dataset backed by Neo4j</a></p><h3>About the Paradise Papers Search App</h3><h4>Background</h4><p>The <a href="https://www.icij.org/investigations/paradise-papers/about/">ICIJ</a> published a fraction of the Paradise Papers data as part of their Power Players visualization at the same time as the reported stories. Some time later, Neo4j added a version of the Paradise Papers dataset, with 163,414<strong> </strong>nodes and<strong> </strong>364,456<strong> </strong>relationships, to the sandboxes available on <a href="https://sandbox.neo4j.com/">Neo4j Sandbox</a>.</p><p><a href="https://www.icij.org/tags/paradise-papers/">Paradise Papers Archives - ICIJ</a></p><h4>Data Model</h4><p>The model includes:</p><ul><li>A company, trust or fund created in a low-tax, offshore jurisdiction by an agent ( Entity )</li><li>People or companies who play a role in an offshore entity (Officer)</li><li>Addresses (Address)</li><li>Law firms or middlemen (Intermediary) that asks an offshore service provider to create an offshore firm for a client</li></ul><p>Each of these carries different properties, including name, address, country, status, start and end date, validity information, and more.</p><p>Relationships between the elements capture the roles people or other companies play in the offshore entities (often shell companies), we see many OFFICER_OF relationships for directors, shareholders, beneficiaries, etc.</p><p>Other relationships capture similar addresses or the responsibility of creating a shell company by a law firm (INTERMEDIARY_OF).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dUfS4pKYtBro7h3L" /><figcaption>Data Model for Paradise Papers</figcaption></figure><p>For a detailed description of the data model, check out <a href="https://neo4j.com/blog/depth-graph-analysis-paradise-papers/">An In-Depth Graph Analysis of the Paradise Papers</a>.</p><p><a href="https://neo4j.com/blog/depth-graph-analysis-paradise-papers/">Paradise Papers: an in-depth graph analysis</a></p><h3>Django-Neomodel</h3><p>The Paradise Papers app uses Django-Neomodel, a Django module allows you to use the Neo4j database with Django using <a href="http://neomodel.readthedocs.org">neomodel</a>.</p><p>Who uses Django, and why? Many python developers (or their employers) prefer to use an ORM such as Django as it allows them to focus on the business logic, the “money query,” or other more complex features of their product while the object mapper handles the relationship between the database, the Python models, and other aspects of web development. <br>Django’s introspection-generated admin portal is another benefit, avoiding the boilerplate code for administrator pages.</p><p>What about neomodel? Similar to Django, neomodel, an object mapper, allows Python developers to focus on solving problems for their users by thinking in terms of domain objects and less in terms of writing Cypher statements.</p><p><a href="https://neomodel.readthedocs.io/en/latest/index.html">Neomodel documentation - neomodel 3.3.2 documentation</a></p><p>Neomodel uses the concepts of StructuredNode and StructuredRel to formalize the relationship between domain objects, Python classes and Neo4j nodes and relationships. (<a href="https://neomodel.readthedocs.io/en/latest/extending.html"><em>Read more about extending </em></a><a href="https://neomodel.readthedocs.io/en/latest/extending.html"><em>StructuredNodes</em></a>)</p><p>But would anyone use neomodel with an existing ORM? If an ORM-based product would like to leverage Neo4j as well, the Django-neomodel plugin would allow them to add Neo4j-based functionality to their existing application.</p><h3>The Example App: Paradise Papers Search</h3><p>The <a href="https://github.com/neo4j-examples/paradise-papers-django">Paradise Papers search app</a> allows users to search and filter for Entities, Officers, Intermediaries, and Addresses, providing results in a list. It is not intended to be a fully-fledged app (although it can be considered such), but is rather <em>an example</em> of how a Python developer could integrate Neo4j into a Django application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*05Hf2qilblnq3y5M" /><figcaption>List view and Search</figcaption></figure><p>Upon clicking a list item, the user can see some details about the item, in addition to Entities, Officers, Intermediaries, or Addresses that might be connected to the item.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2MmpLTxHSBLBr_Se" /><figcaption>Detail View</figcaption></figure><h4>The “StructuredNodes”</h4><h4>Entity</h4><p>In the entity.py file, you will find a class Entity corresponding to Entity nodes in the Neo4j database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c5M6TBKjL-YmBCMptD6Zgw.png" /><figcaption>The Entity StructuredNode (<a href="https://github.com/neo4j-examples/paradise-papers-django/blob/42bd118a57e8aa7e16861b4dd67873f93c1f016b/paradise_papers_search/fetch_api/models/entity.py#L12">GitHub</a>)</figcaption></figure><p>A bit below the Entity definition, take a look at the example serializers. In this example, serializing the Officers, Intermediaries, Addresses, Entities, and Others that have relationships with a particular Entity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nu8KVOBAoYDeAaXjcwe8Hw.png" /><figcaption>The Entity serialize_connections function (<a href="https://github.com/neo4j-examples/paradise-papers-django/blob/42bd118a57e8aa7e16861b4dd67873f93c1f016b/paradise_papers_search/fetch_api/models/entity.py#L55">GitHub</a>)</figcaption></figure><h4>Address</h4><p>Similarly, you can find the Address StructuredNode in <a href="https://github.com/neo4j-examples/paradise-papers-django/blob/42bd118a57e8aa7e16861b4dd67873f93c1f016b/paradise_papers_search/fetch_api/models/address.py#L9"><strong>address.py</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EVP_VTzHic2n46DilflvJw.png" /><figcaption>The Address StructuredNode (<a href="https://github.com/neo4j-examples/paradise-papers-django/blob/42bd118a57e8aa7e16861b4dd67873f93c1f016b/paradise_papers_search/fetch_api/models/address.py#L9">GitHub</a>)</figcaption></figure><h4>Intermediaries, Officers, and “Other”</h4><p>Intermediaries, Officers, and “Other” StructuredNodes can be found in the <a href="https://github.com/neo4j-examples/paradise-papers-django/tree/42bd118a57e8aa7e16861b4dd67873f93c1f016b/paradise_papers_search/fetch_api/models">models</a> directory of the repo.</p><p>Read more in the <a href="https://neo4j-examples.github.io/paradise-papers-django/tutorial/part03.html#start-creating-the-models-files">paradise-papers-django tutorial</a></p><h3>Local App: Sandbox Database</h3><p>First step, set up your local environment.</p><p>Clone the repo:</p><p><a href="https://github.com/neo4j-examples/paradise-papers-django">GitHub - neo4j-examples/paradise-papers-django: A simple Django web app for searching the Paradise Papers dataset backed by Neo4j</a></p><pre>git clone git@github.com:neo4j-examples/paradise-papers-django.git</pre><p>In a <a href="https://docs.python.org/3/tutorial/venv.html">virtual environment</a>, install the requirements:</p><pre>pip install -r requirements.txt</pre><p>Next, you’ll need to point your app to a sandbox instance of the Neo4j database. In <a href="https://sandbox.neo4j.com">Neo4j Sandbox</a>, create an account and select <em>Paradise Papers by ICIJ.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*btgfRLHGXDZ9Jwu3ryOb0A.png" /><figcaption>Sandbox Launch Project Screen</figcaption></figure><p>Check out the graph in the browser by clicking the “Open” button. You will find a informative Graph Guide detailing the dataset:</p><figure><a href="https://sandbox.neo4j.com?usecase=icij-paradise-papers"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y8KJF8gg8zVdm5x_" /></a></figure><p>Back in the Sandbox UI, tap <strong>Connection details</strong> to find the database’s bolt URL, Username, and Password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6hr-T0HSLxN3qJFY" /></figure><p>Since the Paradise Papers Search App uses <a href="https://github.com/neo4j-contrib/django-neomodel">Django Neomodel</a>, which is built on the official Python driver, it is a good idea to double-check the suggested implementation under <strong>Connect via drivers &gt; Python</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t433mt5AKRigv0_Z" /></figure><p>In your local environment, set the DATABASE_URL environment variable using the credentials found in the Sandbox admin:</p><pre>export DATABASE_URL=bolt://&lt;username&gt;:&lt;password&gt;@&lt;ip&gt;:7687</pre><p>Run the app!</p><pre>python manage.py runserver \<br>— settings=paradise_papers_search.settings.dev</pre><p>Start searching at <a href="http://127.0.0.1:8000/">http://127.0.0.1:8000/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VdEJspDvaS7iwAil" /></figure><h3>Local Setup, Local Data</h3><p>Sandbox comes with an expiration date, so if you want to do some additional experimentation, you will have to get the data and import it to your local database. We have made the sandbox datasets, browser guides and code examples available as GitHub repositories, that you can import into your Neo4j installation.</p><p><a href="https://github.com/neo4j-graph-examples/icij-paradise-papers">neo4j-graph-examples/icij-paradise-papers</a></p><p>Fortunately, Neo4j Desktop now supports that out of the box. If you have not yet done so, please download and install <a href="https://neo4j.com/download/">Neo4j Desktop</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*fdAnnGp9fgNNDefDoUGkBQ.png" /><figcaption>Import Sample Project</figcaption></figure><p>Import the repository into desktop, via the <strong>New -&gt; Import sample project.</strong> And pick the icij-paradise-papers from the list. That should prompt you for the database import and create a database and project for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*Mf4i6R5bhcS1g2KtEDt5oQ.png" /></figure><p>Back in your app, update the database environment variables to reflect this new database.</p><pre>export DATABASE_URL=bolt://neo4j:&lt;password&gt;@localhost:7687</pre><h3>Deploy to Heroku</h3><p>An app deployed locally is okay, but what about deployment?</p><p>Create a <a href="https://dashboard.heroku.com">new Heroku app</a>, (for example, paradise-papers)</p><p>Go to the app’s settings and add the following config vars:</p><pre>ALLOWED_HOST : paradise-papers.herokuapp.com<br>(change to your app name)</pre><pre>DATABASE_URL: the credentials from your sandbox database</pre><p>Over in your local terminal inside the repository, add the Heroku app as a remote, then push to Heroku:</p><pre>git remote add heroku <a href="https://git.heroku.com/paradise-papers.git">https://git.heroku.com/paradise-papers.git</a></pre><pre>git push heroku master</pre><p>View your app at the URL you specified in the configuration.</p><h3>Use a Neo4j Aura Database</h3><p>Now that you’ve seen the app in action locally and on a remote server, if you want someone else to be able to visit the app without your computer running, you may want to use a database on <a href="https://neo4j.com/cloud/aura">Neo4j Aura</a>.</p><p>After creating an Aura account, you can import by following the wizard on the <a href="https://console.neo4j.io/#databases"><strong>Aura console</strong></a>. You can drag and drop your dump-file onto the browser to seed your database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*430SmEnS6dLa3R3g" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Qglc9Y-OXBpI5xpn" /></figure><h3>Next Steps</h3><p>After testing out the ICIJ Panama Papers database, you may want to test out using some of the data native to your Django application. Test out converting your relational data set using the <a href="https://neo4j.com/labs/etl-tool/">Neo4j ETL Tool</a>.</p><p><em>Looking for more details on how Neo4j was used in the Panama Papers investigation? Check out our full coverage here:</em></p><ul><li><a href="https://neo4j.com/blog/depth-graph-analysis-paradise-papers/">An In-Depth Graph Analysis of the Paradise Papers</a></li><li><a href="http://neo4j.com/blog/icij-neo4j-unravel-panama-papers/">How the ICIJ Used Neo4j to Unravel the Panama Papers</a></li><li><a href="http://neo4j.com/blog/analyzing-panama-papers-neo4j/">Analyzing the Panama Papers with Neo4j: Data Models, Queries &amp; More</a></li><li><a href="http://neo4j.com/blog/panama-papers/">The Panama Papers: Why It Couldn’t Have Happened Ten Years Ago</a></li></ul><h3>Resources</h3><ul><li><a href="https://github.com/neo4j-contrib/neomodel">neo4j-contrib/neomodel</a></li><li><a href="https://github.com/neo4j-contrib/django-neomodel">neo4j-contrib/django-neomodel</a></li><li><a href="https://github.com/neo4j/neo4j-python-driver">neo4j/neo4j-python-driver</a></li><li><a href="https://thobalose.co.za/2016/neomodel/#">Getting Started with Neomodel</a></li></ul><h3>About the Authors</h3><p>Cristina and Alisson work at <a href="https://tsl.io/">The SilverLogic,</a> a software development company based in Boca Raton.</p><p>Alisson is a software engineer at <a href="https://tsl.io/">The SilverLogic</a>. Passionate about plants, he is the driving force behind <a href="https://queplanta.com/">Que Planta</a>, a GraphQL-based social network for plants.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efd0e39e5f2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neo4j/neo4j-for-django-developers-efd0e39e5f2e">Neo4j for Django Developers</a> was originally published in <a href="https://medium.com/neo4j">Neo4j Developer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>