Christian,

Maybe it's unfinished or maybe not, but it certainly is awkward and
confusing to use.

Here's something that worked for me: Run it from within the
generateds/django directory, but before you do, either copy
generateDS.py into that directory, or make a symbolic link to it
there.

The following worked for me:

    $ hg clone https://dkuhl...@bitbucket.org/dkuhlman/generateds
    $ cd generateds/django/
    $ lns ../generateDS.py .        # Or: $ cp ../generateDS.py .
    $ cp ../tests/people.xsd .
    $ ./gends_run_gen_django.py -f -v people.xsd

I'm going to consider removing the -p command line option.  It was
intended to make use more convenient, but, as you found, seems to
only makes things more difficult.

Below, there are some more detailed instructions.  Perhaps I'll put
them in a README in the generateds/django directory or will add them
to the instructions in the generateDS.py documentation, which you
can find here:
http://www.davekuhlman.org/generateDS.html#django-generating-models-and-forms

Instructions:

============================================

Although, there are likely other configurations that will work, one
reasonably simple way is the following:

1. Download the source distribution of generateDS with the
   following::

       $ hg clone https://dkuhl...@bitbucket.org/dkuhlman/generateds

   Alternatively, you can download a Zip file from here:
   https://bitbucket.org/dkuhlman/generateds/downloads/

   Or, a tar file from here:
   https://pypi.python.org/pypi/generateDS

   And, then unroll it.

2. Change directory to the ``django`` directory::

       $ cd generateds/django

3. In that directory, either, (a) create a symbolic link to
   ``generateDS.py``::

       $ ln -s ../generateDS.py

   Or, (b) copy ``generateDS.py`` to that directory::

       $ cp ../generateDS.py .

4. In that directory, Run ``gends_run_gen_django.py``.  For
   example::

       $ cp ../tests/people.xsd .
       $ ./gends_run_gen_django.py -f -v people.xsd

If the above ran successfully, it should have created these files::

    admin.py
    forms.py
    models.py

============================================

Hope this helps.  And, thank you for reporting this.  I do need a
little motivation to work on it and at least try to make it better..

Let me know if the above instructions worked and made it easier for
you, and if you have suggestions.  If the above instructions seem
helpful, I can add them as a README file in the ``django``
directory.

Dave

On Sat, Dec 02, 2017 at 05:21:37PM +0100, Christian González wrote:
> Hi Dave,
> 
> sorry to disturb you using mail, but on bitbucket, I didn't find a way to
> open an issue.
> 
> I just stumbled upon your generateDS script. Tried to get it to work
> generating a Django model, using
> http://www.davekuhlman.org/generateDS.html#django-generating-models-and-forms
> - but it did not work.
> 
> Could it be that this is a bit "unfinished"?
> I first tried to "pip install generatedDS" and copy the django/ content
> "over", into the current directory. Did not help.
> 
> Then I uninstalled it again, got the source from bitbucket, installed it
> into my virtualenv using setup.py build/install.
> I can call generatedDS, and all gends_run* and gends_generate*,
> gends_extract* files from my virtualenv
> 
> But everytime I start gends_run_gen_django.py, It tells me that it "Cannot
> find generateDS.py.  Use "-p path" command line option." And if I give it
> the path using
> 
> /home/christian/tmp/fhir$ gends_run_gen_django -f -p
> ~/.virtualenvs/generateDS/bin/generateDS.py schema.xsd it raises the
> following error:
> ------------------------
> *** error ***
> Traceback (most recent call last):
>  File "./gends_generate_django.py", line 82, in generate_model
>    import generatedssuper
>  File "/home/christian/tmp/fhir/generatedssuper.py", line 5, in <module>
>    from generateDS import AnyTypeIdentifier, mapName, cleanupName
> ModuleNotFoundError: No module named 'generateDS'
> 
> * Error.  Cannot import generatedssuper.py.
> Make sure that the version of generatedssuper.py intended
> for django support is first on your PYTHONPATH.
> 
> *** error ***
> ------------------------
> 
> I don't know why it doesn't find generateDS.py despite being in my PATH, I
> can call it without problems.
> And I don't know why it doesn't import the generateDS neither.
> 
> Could you give me a hint, I tried to follow the path at 
> http://www.davekuhlman.org/generateDS.html#how-to-generate-django-models-and-forms
> closely.
> 
> 
> BTW:
> * you should add Python dependencies to it: gi and lxml are needed to run.
> * generateds_gui seems to be Pyhton2 only:
> ------------------------
>    print url
>            ^
> SyntaxError: Missing parentheses in call to 'print'. Did you mean print(t
> url)?
> ------------------------
> 
> Yours, Christian

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to