django project daesn't work on subdomain - django

I'm new in python and django.
I have virtual hosting account on bluehost.com. I have main site in public_html folder (cms - wordpress). Now I want make django project on subdomain. I found hoster's instruction and setup python 2.7 on my hosting. I installed django 1.6 too (by official manual). Both works correctly (I checked it by ssh-consol)
With django-admin.py I've created app. Also I've created subdomain and directed it to the same folder.
Now I have structure:
/user - my account folder<br>
/user/python - python folder<br>
/user/django - django folder<br>
/user/public_html - main site folder<br>
/user/public_html/dev - project and subdomain folder
I'm in stalemate, because project doesn't work. When I go on dev.main_site.org, I see just hoster's html default page. But, if I right understood instruction I should see demo project (sign-in page). How to correct it?
Thank you!

There are many steps to be gone through, to host your app. You have to setup an app server, like gunicorn, and connect it to the main server, say apache..
May be this should help...

Related

Where are the Django and python files?

I'm new to Django and Python, I'm coming from Laravel.
I'm working on a Windows machine.
My Laravel project has tons of folders (vendor etc.) and is >100 MB my Django project is <50kB.
In the end, I want to upload my Django project to a webserver.
But I'm curious where the Djangofiles on my computer are located, and how deployment works. (what are the essential parts/files compared to Laravel (Project Folder + DATABASE) which I've to transfer)
Is the Django Framework similar to a Javascript file, which I can put I my project folder or get via linking?
The place you move your Django project folder to on your server is where your Django files is located. Django files might be small in size, however, to run your Django application you will need to install +100MB packages from PIP.
The essential part of Django is your project directory and your requirements.txt file in which all python package required to run your application will be listed in it.
Django is not similar to a Javascript file, Django is a complete web development framework similar to Laravel framework, you may refer to this Head-to-Head comparison between Django and Laravel: Here
For more details on deployment you may refer to the following tutorials:
Hosting Django with Nginx: Nginx + Django
Hosting Django with Apache: Apache + Django

Heroku set default site

I have created a new Heroku site and I am developing it on my Linux box, using Django. The standard "getting started" site Heroku created for me is called "gettingstarted". How can I change that / configure Heroku to forget about it?
I was reading through the Django tutorial, which explains how to create a new site (django-admin startproject my_site). I did this successfully for a demo project. Then I tried to do it under the Heroku directory, because I wanted a better name for my site than "gettingstarted". I noticed that every time I start the Heroku server under my project, it says ...using settings 'gettingstarted.settings'. I found that this is configured in manage.py and I change it.
This is the directory layout I have
/some/path/heroku_random_name/gettingstarted/settings.py
/some/path/heroku_random_name/my_site/settings.py
/some/path/heroku_random_name/my_app
This is what I have in
/some/path/heroku_random_name/manage.py
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_site.settings')
so I would expect that the site that matters is my_site.
I got it to the point where I can run the site successfully on my local machine, and I can tell that it using the settings from my_site. But when I deploy the project to Heroku, it does not recognize my_app until I register it in gettingstarted/settings.py. In other words, when running in Heroku, it is still using gettingstarted as the site to run.
I am new to all this, so I left gettingstarted in the project, because I am afraid to break things. But how can I configure Heroku to execute settings from my_site and not from gettingstarted?
Found it: it's configured in Procfile.
It's confusing because it's configured in one place for running locally and in a different place for running hosted at Heroku.

ubuntu django and apache, cannot find the site

I am brand new to web app development and thought I would try django as I am familiar with python. I followed the following guide: http://www.lennu.net/2012/05/14/django-deployement-installation-to-ubuntu-12-dot-04-server/ to deploy a django page to the letter. However, I now realize that this guide was for the server version of the OD and i'm running the desktop version. When I try to open my site in chrome (amitash.r) it fails with a page not found. Now when I open localhost, I get an internal server 500 error. All my config files are exactly as stated in the guide. Any fixes?
Can you post your mod_wsgi script and Apache VirtualHost file?
Following the instructions from the link you gave, the mod_wsgi script should be in:
/srv/my_project/app/conf/apache/django.wsgi
The VirtualHost file location from the link should be:
/etc/apache2/sites-available/DOMAIN
Make sure you enabled your site. If you named your file DOMAIN, like the instructions, you should enable the site using:
a2ensite DOMAIN

Django through apache

I am having a great deal of trouble deploying a django website written for 1.3 behind apache using django 1.4 and wsgi. There is also a wordpress site running on the same domain too. Ideally I would like to have django site running on [domain]/app/.
Does anybody have any links to a good tutorial. I am having a lot of trouble working out where to put wsgi.py file. It keeps saying it cannot find it.
When I was recently working to deploy my first django project, I found this tutorial helpful. It independently tests if django and wsgi are working using simple "hello world" applications for each and gives an example of how to make the wsgi.py file work right. I think it's not really a question of putting wsgi.py in the right place; it's more a question of telling Apache where wsgi.py is. If you can get the tutorial working it ought to be relatively straightforward to get your full django site working.
For the Django site, should simply be a matter of having:
WSGIScriptAlias /app /some/path/project/wsgi.py
In other words, the '/app' mount point is used with WSGIScriptAlias instead of '/' that many examples use.
If using login features, you may also need to set LOGIN_URL etc in Django settings file however, as it doesn't automatically incorporate in the mount point.

Deploying a "working when run locally via pycharm" django app to webfaction

I've been following the steps in the box under "Configuring Django" here to try and get the django app up onto webfaction after getting it to work locally.
I zipped my project folder and used scp myproject.zip catubc#web513.webfaction.com to get it up. I then used ssh and moved the zip to $HOME/webapps/plot_composite_metrics as the linked steps instruct and unzipped it there. Since the name of my project is "myproject" I didn't have to do steps 6-7.
From the webfaction control panel I have made an application and called it plot_composite_metrics, Django 1.9.1 (mod_wsgi 4.4.21/Python 2.7). I also made a new website called good_morning_cat and added plot_composite_metrics to it.
I have ALLOWED_HOSTS = ['catubc.webfactional.com'] in settings.py
So, as per this example why do I get a "server not found" when I navigate to http://good_morning_cat.catubc.webfactional.com/? What did I forget to do to link my working-locally via pycharm app to said domain?
I have seen this related question, sadly I believe I am using the correct python version, so that's not the issue. Additionally, I do have a paid account if that makes any difference.
You have to add all the domains in the WebFaction control panel, i e http://good_morning_cat.catubc.webfactional.com/ as well.
http://catubc.webfactional.com/ works as this is what you have specified, it's resolved anyway. There's an ImportError because you haven't installed all your dependencies.