Forums

pointing my domain to my web app

I have been testing my first app on the server, which means I have not pointed my domain to this app yet. Now I am ready to point my domain. Sounds like the easiest way to do this is to 1. delete the app 2. point the domain 3. upload the app again.

Is this right or am I misunderstanding the process?

You can do it that way, but there's an easier way:

  1. Take a copy of the WSGI file for the web app that is working.
  2. Create a new "Manually configured" web app for the custom domain.
  3. Copy the WSGI file from step 1 over the WSGI file for the new domain.

You now have 2 web apps running the same code at different URLs.

Thanks Glenn,

So I just copy and paste the code in the kakasfdd310_pythonanywhere_com_wsgi.py file into the same file in the new "Manually configured" web app for the custom domain when I create it?

Regarding the database: Currently my test app is running with the sqlite,I have not changed it to mysql yet. After I pointed my domain to my app, I am going to switch to mysql. When I create the mysql database, I should give it the same db name what I used during the development with sqlite, right? That's all I have to do, right?

BTW: how do I have to change this below exactly in my app to connect to mysql properly: db = DAL('sqlite://storage.sqlite'................])

I am doing this for the first time so please kindly advise me if I am missing anything regarding the WSGI or the mysql database set up.

Thanks very much.

Yes to the WSGI file copy.

Naming your database: You can name it anything you like. On PythonAnywhere, we prepend <username>$ to the database name that you request. So, if you name your database mydatabase, the name of the database that you need to use for connecting to it is kakasFDD310$mydatabase.

The connection string for your DAL constructor will be:

mysql://kakasFDD310:db_password@kakasFDD310.mysql.pythonanywhere-services.com/kakasFDD310$mydatabase

I have just added a new app but I must have missed something.

I have pointed my domain, I went through the process of adding a new app, set up the admin password and the directory where the app should be placed as instructed. It all works fine, now my domain is live on pythonanywhere but my packed web2py app is not uploaded. I can't find where I am supposed to upload it. So my domain now displays the welcome app, not my app because my app is not uploaded.

I thought I am supposed to set up the add new app with my domain then upload my app. Can you please help me with this ASAP.

Thanks very much

Ok, I found a way to upload my App, so please ignore my previous post.

The issue now is that when I go to my domain, the welcome app shows up by default, instead of my site. I have to type in my domain/<myappname> to get to my app. How can I fix this so my app comes up as a default just by typing in mydomain.com

I tried to redirect from the welcome app to my app while I am waiting for reply and I probably shouldn't have done that now I can even get to the welcome app, I get an error message

BTW: the domain that I am talking about is:www.degroup-media.com

OK, the best way to debug this is for you to take a look at the error message. To see it, go to your domain so that you get a link to the error, and click on it. You'll probably get a page saying that admin is disabled because you're not using a secure channel. To fix that, edit the URL and change the http at the start to https. That should take you to a certificate warning page, because you don't have an HTTPS certificate installed on PythonAnywhere, but if you go past that it will take you to the web2py login page, where you can log in with the admin username and password you set up when you created your web2py app. Once you're past that, you should get the details of the error -- hopefully things will then be pretty clear, but if not, you can post them here and we'll see if there's anything we can do to help.

Thanks very much! I was able to log in and clear up the error, however, I still need some help setting up that mydomainname.com will open the index page of my app and not the index page of the welcome app.

Please advise on how to make this happen.

Thanks.

My app is in the we2py folder but not in the web2py>applications folder. I guess that might be the problem? So if I place the app folder in the web2py>application folder then it will work with my domain? If so, then I have to delete it from the web2py folder and upload it again into the web2py applications folder?

Hi there -- unfortunately you're getting beyond my knowledge of web2py :-( But the guys on the web2py Google group are normally really helpful and responsive!

thanks very much! I figured it out, looking at the google group helped! The problem was that when I upload my app I have to name it "init". I didn't know that. Now it works. Thanks

now I am trying to connect to the database so I use the connection string you sent me earlier and I am unable to save it as I get a syntax error.

mysql://kakasFDD310:db_password@kakasFDD310.mysql.pythonanywhere-services.com/kakasFDD310$mydatabase

please ignore my last post, I figured out the database connection issue, my fault!

As I mentioned, I connected one domain name, the site is live working, no problem. Now, I am trying to do the same thing with my second domain to "Add a new app" using this second domain but this one is not connecting. I get this same message every time I try:

"Sorry, there was an error connecting to the server. Please try again in a few moments... "

The CNAME has been changed and the domain is pointing here.

Now I tried again and the server was able to connect so it worked. Not sure what was the issue earlier.

I think the problem was probably DNS propagation. When you make a change to DNS settings (like adding a CNAME) then it can take time to propagate across the Internet and reach us, and indeed to reach your ISP. Until that happens, you'll see the old settings and that can cause some odd errors.