Comments (7)
Use factoryboy for it.
https://github.com/rbarrois/factory_boy
from quokka.
In my honest opinion, better than use a external tool, we can take advantage of mongoimport[1].
With mongoimport (which comes with MongoDB facilities) we can just issue a command to import a json file to the database since it is just sample data.
1: http://docs.mongodb.org/manual/reference/program/mongoimport/
from quokka.
👍
Do you how to implement it? so I think we just need to create the source files matching Quokka's database model. (is there a mongoexport tool? to generate raw Json from the current database?)
Also, we will need to write up a tutorial in a wiki page or maybe create a script to run it from manage.py populate
from quokka.
amazing! http://docs.mongodb.org/manual/reference/program/mongoexport/
from quokka.
Yes and it is mongoexport that you described above.
mongoexport exports collection so I think I should iterate over all models which create collections and issue the command mongoexport using the same approach with mongoimport. "show collections" MongoDB command could do the job as well.
from quokka.
So, I have worked in this approach:
https://gist.github.com/mauricioabreu/6590333 (code is not finished, but you get the idea)
But it is going wrong for several reasons.
Let's describe them one by one:
1 - It is hard to maintain since mongoexport has no limit (actually it is comming soon, but nowadays it is not even an option). to achieve success on this it would require a workaround to generate low amount of records.
2 - It is based of files, so a lot of things can happen like (wrong file, corrupted file, no permissions, etc)
3 - It is hard to check if a class creates a physical collection (this is why I am checking if it is a subclass of DynamicDocument and Document from mongoengine)
I think factory boy is a better approach in this case.
from quokka.
Thanks to @abnerpc there is now a populate from json file. I think there is no need to use mongodump for this feature.
from quokka.
Related Issues (20)
- Quokka ScreenShots HOT 6
- How to setup by Using MongoDB docker
- Quokka installation more instructions. HOT 5
- Info about static files HOT 2
- Logout Action in Admin HOT 3
- Guidance and advice, if possible, please... HOT 1
- replace markdown (mistune) with Commonmark
- Quick Start: 'make adduser' throwing exception HOT 3
- jinja2.exceptions.UndefinedError: 'theme' is undefined HOT 1
- Neither pyproject.toml nor flit.ini found, and no other config file path specified HOT 1
- What license is this? HOT 4
- demo site is down? HOT 3
- removing files/modules unused from Quokka project HOT 1
- Cross Site Scripting Vulnerability in Latest Release HOT 1
- XML External Entity (XXE) Vulnerability in Latest Release HOT 1
- TODO: list from quokka/quokka/core/content/models.py HOT 2
- Change version of `dynaconf` in `requirements.txt`
- Small typo in quokka/core/content/views.py
- make adduser fail - AttributeError: module 'mistune' has no attribute 'Renderer' HOT 1
- closed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quokka.