nephila / djangocms-installer

Console wizard to bootstrap django CMS projects
https://djangocms-installer.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
177 stars 78 forks source link

djangocms-installer bug with conda #275

Closed fakegit closed 8 years ago

fakegit commented 8 years ago

I used conda to create python env on my win7 amd64 pc.

django-admin.py file is in the root python's subdir '/Scripts/' folder. but djangocms-installer try to find the django-admin.py in the python root.

yakky commented 8 years ago

The path of django-admin is currently a requirement of djangocms-installer (as documented https://github.com/nephila/djangocms-installer#warning). Installer is currently only tested with virtualenv

fakegit commented 8 years ago

I see. And I fixed the problem myself, I find the file djangocms_installer.django.init.py, and change line 42 start_cmd = os.path.join(os.path.dirname(sys.executable), 'django-admin.py') to start_cmd = os.path.join(os.path.dirname(sys.executable), 'Scripts', 'django-admin.py') It works.

yakky commented 8 years ago

@fakegit unfortunately this change is not portable. As I am not familiar with Conda, is there any way to discover a conda environment, instead of a virtualenv one?

fakegit commented 8 years ago

@yakky Conda install the default python and envs in the directory Miniconda3: Miniconda3/python.exe _Miniconda3/envs/someenv/python.exe But you can change the directory as you like, so not a good solution to check Miniconda3 in python's executable dir.

Maybe bellow is considerable:

start_cmds = [os.path.join(os.path.dirname(sys.executable), 'django-admin.py')]
start_cmd_pnodes = ['Scripts']
start_cmds = start_cmds.extend[
    os.path.join(os.path.dirname(sys.executable), pnode, 'django-admin.py') for pnode in start_cmd_pnodes
]
for p in start_cmds:
    if os.path.exists(p)):
        start_cmd = p
        break

I'm not a good pythoner, sorry for my poor code.

yakky commented 8 years ago

@fakegit thanks I'm going to integrate your proposed code in 0.9