How to integrate Django and Cygwin?

后端 未结 9 1268
野趣味
野趣味 2021-02-14 11:35

I have a Windows box with cygwin, python and django installed.

Now I want to run django-admin, but when I do I get the error:

$ django-admin.py
c:\\Pytho         


        
相关标签:
9条回答
  • 2021-02-14 12:13

    As for the step on how to start your django in cygwin

    first open your windows command prompt then register the python environment by doing this:

    Path %path%;C:\Python27;C:\Python27\Scripts
    

    then now go to the installation folder of your cygwin

    cd C:\cygwin
    

    then run the cygwin.bat like this:

    C:\cygwin>cygwin.bat    <enter>
    

    then cygwin will open, and type python to see if it now working

    $ python
    

    Voila we are done!

    0 讨论(0)
  • 2021-02-14 12:15

    Sort of sounds like the windows version of Python is trying to run instead of the cygwin one. What happens if you type this:

    $ python django-admin.py
    

    Here I'm assuming

    $ which python
    

    Finds the cygwin version of python (which will be something like /usr/bin/python).

    You may also try (temporarily) uninstalling the windows version of python and use only cygwin.

    0 讨论(0)
  • 2021-02-14 12:18

    Just copy the django-admin.py to the current location you are working on for e.g

    on Cygwin:

    <root>/projects/
    

    on your windows directory it will look like this:

    C:\cygwin\home\<your computer name>\projects\
    

    once you copy the file, you can create your project by typing this command:

    $ python django-admin.py startproject mysite
    

    and that's all - you have completed your first project using the Cygwin linux-like environment.

    0 讨论(0)
  • 2021-02-14 12:19

    Like Brian mentioned you are running the Windows version of Python which won't work with the Cygwin installation.

    A word of warning. When I first started using Django, I tried installing it in Cygwin and had a variety of problems and ended up switching to the regular Windows version of Python. Unfortunately, I didn't document all my issues, but I remember some of them had to do with the database libraries. Anyway, that was a few months ago when I knew less about Django than I do now. Maybe the problems I ran into have been solved and perhaps now that I know more I could get it to work, but running Django on Cygwin does seem to be the road less traveled. Good luck. :)

    0 讨论(0)
  • 2021-02-14 12:25

    I just ran into the exact same problem. I've found that if you already have the windows version of python installed, it seems to get priority over the cygwin version. I solved the problem by editing /etc/profile and changed:

    PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH
    

    ...to:

    PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:
    

    ...which I think stops cygwin from adding the normal windows path. Once you've got that working, download django into some directory, move into that directory and type:

    python setup.py install
    

    I was having problems to begin with because I had omitted the 'python' bit at the start

    0 讨论(0)
  • 2021-02-14 12:34

    Help us help you. Is there a reason why you are running the windows python interpreter (c:\Python26\python.exe) as oppose to the cygwin python interpreter (/usr/bin/python.exe)? That could be your problem. So to troubleshoot that, you might consider removing the windows native interpreter or simply making sure the cygwin path is listed before the c:\Python26 path in the windows global PATH variable.

    0 讨论(0)
提交回复
热议问题