Django doesn't run

django

#1

Looks like django workspaces are still using syncdb automatically on run which has been removed. Also when running a base django it doesn’t appear to be at the standard URL given nor does it seem to correctly show up using host:8000/admin

Tagged: @bradydowling


#2

Hey @Konshu :slightly_smiling:,

You’re the second to report on issues with Django Admin in the Django templated workspace:

Last I checked the Django templated workspace was running Django 1.8 out of the box.
Running sudo pip -U django should get it to Django 1.9.


#3

Hi,

Another thing I noticed was that you’re trying to access :8000, which isn’t supported. Cloud9 supports ports 8080, 8081, and 8082. Please change the admin interface’s port to use port 8081 or 8082 if you’re already using port 8080. You can find more about multiple ports here.

Regards,
​Mutahhir


#4

I have attached several examples of ways to run django, some are custom port some are literally following the readme provided by C9. How I ran across this initially was before adding in my code, testing an out of the box build to ensure no errors by using “run” as mentioned in the readme. Through further configuration and attempts to run you can see where the results continue to reproduce.


#5


#6


#7


#8

@Konshu Try running python ./manage.py runserver $IP:$PORT in a terminal (ALT + T). I never use the little shell at the bottom myself.


#9

See screenshots above, there is an example of me doing so. I used both the ALT-T or bash prompt option as well as the IDE method of “run” button at the top. Both fail.


#10

I actually don’t see that you run the server by $IP and $PORT, instead I only see that you, twice over, hard code the IP and port to 127.0.0.1 and 8000/8080 which are both wrong. The last version (joined in the last screenshot) is using djangos own resolver which also will not work, it will default to a loop-back address of 127.0.0.1.

The $IP of any server will be 0.0.0.0. Try that directly.


#11

I see, I apologize, I was mentally interpreting $IP and $PORT as variables you wanted me to fill in vs actually typed out reference. That solution works from bash, though I think the run solution from the IDE may need to be updated to reflect syncdb and the $IP:$PORT


#12

Hey @Konshu,

:ballot_box_with_check:

Glad you got it. I usually link the docs in my first reply but for anyone else that finds this post later, here’s the official Cloud9 Django Doc.

:speech_balloon: python ./manage.py runserver $IP:$PORT


#13

Yes, on django 1.9 syncdb is removed.

I posted solutionon forums, but, I also copy it in this thread.

The easy work around is to create a fake syncdb with a custom django-admin command, create this structure in one of your apps:

someApp/
    management/
        __init__.py
        commands/
            __init__.py
            _private.py
            syncdb.py   <----

Then fill syncdb.py file with this code:

from django.core.management.base import BaseCommand

class Command(BaseCommand):
    help = ''

    def handle(self, *args, **options):
        self.stdout.write('fake syncdb')