Sharing Mac OS X and Django

I created a web application with Django, and it works for me on localhost ( http://127.0.0.1:8000/ ), my question is: how can I make it available to the whole world using Mac OS X sharing or something- something like that?

Thanks!

+4
source share
3 answers

First of all, I would strongly suggest that you donโ€™t serve the website from your Mac. This is a really bad idea. Both Mac OS X web access and Django, which is included in the http server (which I believe you use), are intended only for testing for a number of reasons regarding speed, security, etc. which is frankly too long, to post here (but I hope someone will :)

Secondly, it is already open to the whole world: everyone can connect to your computer using your IP address, and not loopback 127.0.0.1 (if you are not NAT). This, again, is very useful to check (and your friends / colleagues / boss) to check temporarily , but again it is not suitable for use in production. Indeed.

+3
source

While you start the server, specify a public ip or for any use ip 0.0.0.0

Example:

sudo python manage.py runserver 0.0.0.0:80

If you run your application without ip and port, its binding is only for loopback, which is 127.0.0.1 and will not be available on your network.

+12
source

It depends on your real purpose, what you mean by "accessible to the world ... or something." If you want it to be constantly accessible from the Internet, you need to place it on the server (whether it is shared or dedicated), you wonโ€™t keep your Mac turned on forever, right? :)

To host Django on shared hosting - I would recommend webfaction, step-by-step guides for setting up a Django project can be found in their scripts and forums ($ 9.50 per month for a basic plan, with a two-month money back guarantee, which actually works, I tried it myself :) . Additional Options at Djangofriendly.com

For a dedicated server, ask yourself if you prefer to manage the entire server (OS, web server, database server, memcache, firewall, backups ...) yourself. If the answer is yes, check out Linode , Rackspace or Slicehost or even amazon web services , but keep in mind that this is more expensive, it is more complicated, but it gives you ultimate flexibility. When you are ready to try, this is one of the best lessons I have found on the net for this subject .

If all you need is proof of the concept that โ€œeverything I can get from my web browser should be accessible from anywhere in the world,โ€ ask your Internet provider if you are provided with a private iPaddress. If not, hmm, better go for the options mentioned above :) If so, find out what IP it is by visiting whatismyipaddress.com . Then start the web server as suggested by Prashant and enter the IP address from whatismyip.org in your browser. Get nothing? a) disable the MacOSx firewall. nothing yet? b) connect the Mac directly to the network cable provided by your provider, without a router between them. Re-enter your IP address in the browser. Works? excellent, go to google port forwarding, it will say that you need to configure the router for the same effect when using the router. Is not it? Ask a separate question in stackoverflow and provide as much information as possible about what you are doing as you can.

Sharing Mac os is not practical if the packages are not routed correctly to access your computer on the network. I think all he can do is start apache and open some ports in the firewall. But if your personal router or Internet service provider does not forward external packets to your computer, you will not get what you want.

Good luck

0
source

All Articles