DataSwede
DataSwede

Reputation: 5591

Django- specifying url in runserver

I'm attempting to integrate social signon into a project, and am following along this tutorial: http://www.artandlogic.com/blog/2014/04/tutorial-adding-facebooktwittergoogle-authentication-to-a-django-application/.

Step #4 shows that the project requires a 'real url'. It appears you used to be able to specify a url when running manage.py runserver example.com (https://code.djangoproject.com/ticket/14928)

However, on Django 1.6.5 this results in CommandError: "example.com" is not a valid port number or address:port pair.

What is the easiest way to run a local webserver so that my django project appears at whateverurl.com?

Upvotes: 1

Views: 3653

Answers (1)

Paulo Scardine
Paulo Scardine

Reputation: 77281

If you are using a unix-like OS, edit /etc/hosts and include:

127.0.0.1    example.com

If you are on windows, look for %WINDIR%\system32\drivers\etc\hosts.

Then you can use python manage.py runserver example.com:80

Note that external servers will not be able to call example.com, if the API you are testing requires the provider server to call this URL directly, you can only use this to test against a local provider.

Upvotes: 5

Related Questions