Build a virtual machine environment and Django website on pythonanywhere.com Free website

Source: Internet
Author: User
Tags django website virtual environment

Sign up, add apps, select python3.5, then open the console
    • Build python3.5 Virtual Environment
    python  --version    virtualenv -p /usr/bin/python3.5 VENV    source VENV/bin/activate
    • Installing Django
    pip install "django<1.9"
    • Create a Web site
    django-admin startproject mvote    cd mvote    python manage.py startapp mysite
    • You can upload files such as template,static file through the website file.
    • Modify the setting.py file
    • Installen_app Join MySite
    • allowed_hosts = [' * ']
LANGUAGE_CODE = ‘zh-CN‘TIME_ZONE = ‘Asia/Beijing‘USE_I18N = TrueUSE_L10N = TrueUSE_TZ = True# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/1.8/howto/static-files/STATIC_URL = ‘/static/‘STATICFILES_DIRS = [    os.path.join(BASE_DIR,‘static‘),    ]STATIC_ROOT = "/home/guguobao/mvote/staticfiles/"
    • Click on it, modify the following, go beyond this, also modify mvote/wsgi.py for the same content

# +++++++++++ DJANGO +++++++++++# To use your own django app use code like this:import osimport sys### assuming your django settings file is at ‘/home/guguobao/mysite/mysite/settings.py‘## and your manage.py is is at ‘/home/guguobao/mysite/manage.py‘path = ‘/home/guguobao/mvote‘if path not in sys.path:    sys.path.append(path)os.environ[‘DJANGO_SETTINGS_MODULE‘] = ‘mvote.settings‘# then:from django.core.wsgi import get_wsgi_applicationapplication = get_wsgi_application()
    • Modify a static URL for a Web page

Create a virtual machine environment and a Django Web site on pythonanywhere.com free web site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.