Giter VIP home page Giter VIP logo

python-getting-started's Introduction

Python: Getting Started

A barebones Django app, which can easily be deployed to Heroku.

Deploying to Heroku

Using resources for this example app counts towards your usage. Delete your app and database as soon as you are done experimenting to control costs.

By default, apps use Eco dynos if you are subscribed to Eco. Otherwise, it defaults to Basic dynos. The Eco dynos plan is shared across all Eco dynos in your account and is recommended if you plan on deploying many small apps to Heroku. Learn more about our low-cost plans here.

Eligible students can apply for platform credits through our new Heroku for GitHub Students program.

This application supports the Getting Started with Python on Heroku article - check it out for instructions on how to deploy this app to Heroku and also run it locally.

Alternatively, you can deploy it using this Heroku Button:

Deploy

For more information about using Python on Heroku, see these Dev Center articles:

python-getting-started's People

Contributors

arthurzenika avatar caseyfaist avatar dependabot[bot] avatar dtzitz avatar edmorley avatar essobi avatar evansd avatar fanquake avatar jdanford avatar jkutner avatar johan718 avatar jonmountjoy avatar jonnymacs avatar kennethreitz avatar kevinbrolly avatar kuaima avatar ntassone avatar odazai avatar ojongerius avatar prateeksane avatar rhcarvalho avatar rhyselsmore avatar schneems avatar servusdei2018 avatar silverbux avatar slashme avatar stephenbarlow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-getting-started's Issues

DATABASES in gettingstarted/settings has duplicate configs

We config DATABASES from line 59 as

# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

and there is a duplicate config start from line 89

# Parse database configuration from $DATABASE_URL
DATABASES['default'] =  dj_database_url.config()

So when we follow the guide to running locally, the syncdb command will suck and get error output end with

$ python manage.py syncdb
...
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

that because of the DATABASES is set as dummy

$ python manage.py diffsettings
...
DATABASES = {'default': {'AUTOCOMMIT': True, 'ENGINE': 'django.db.backends.dummy', 'ATOMIC_REQUESTS': False, 'NAME': '', 'TEST_MIRROR': None, 'CONN_MAX_AGE': 0, 'TEST_NAME': None, 'TIME_ZONE': 'UTC', 'TEST_COLLATION': None, 'PORT': '', 'HOST': '', 'USER': '', 'TEST_CHARSET': None, 'PASSWORD': '', 'OPTIONS': {}}}
...

maybe the README should tell newbies to setup their postgres and export DATABASE_URL first, or use sqlite only when running locally

"python manage.py migrate" not working for me

aaronmiller$ pip list
Package Version


dj-database-url 0.5.0
Django 1.11.17
django-heroku 0.3.1
gunicorn 19.9.0
pip 18.1
psycopg2 2.7.6.1
pytz 2018.7
setuptools 39.2.0
wheel 0.31.1
whitenoise 4.1.2

Python 2.7.15 and 3.7.2

ANYWAYS. When I do:

python manage.py migrate

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/init.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/init.py", line 308, in execute
settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/site-packages/django/conf/init.py", line 56, in getattr
self._setup(name)
File "/usr/local/lib/python2.7/site-packages/django/conf/init.py", line 41, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/site-packages/django/conf/init.py", line 110, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/Users/aaronmiller/Development/python-getting-started/gettingstarted/settings.py", line 14, in
import django_heroku
File "/usr/local/lib/python2.7/site-packages/django_heroku/init.py", line 1, in
from .core import *
File "/usr/local/lib/python2.7/site-packages/django_heroku/core.py", line 45
def settings(config, *, db_colors=False, databases=True, test_runner=True, staticfiles=True, allowed_hosts=True, logging=True, secret_key=True):
^
SyntaxError: invalid syntax

I would really like any ideas. I am new to python and am trying to warm up to it by doing this.

pip install django-heroku is giving errors in Ubuntu 20.04

I have had this issue everytime i tried to install packages from requirements.txt. It turns out the package django-heroku is not used anymore, it changed to django-on-heroku. The tutorial on how to create a python app should change this.

How can i import pyrebase to django python?

Hello i followed all the instructions here in README.md and when i tried to do a migrate i got the error:

File "/app/DjangoSite/urls.py", line 18, in
from . import views
File "/app/DjangoSite/views.py", line 2, in
import pyrebase
ModuleNotFoundError: No module named 'pyrebase'

How can i solve this two errors?
By the way, i'm not using any sql database like postgreSQL and when i opened my app i got application error.

Django 1.8 TEMPLATE_DEBUG deprecation warning

Same issue as heroku/heroku-django-template#26

I get the following warning with the template.
WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DEBUG.
It's nothing serious, and can be easily solved with this
https://stackoverflow.com/questions/32445953/django-app-works-fine-but-getting-a-template-warning-message

"Declare app dependencies" - installation error

At Declare app dependencies guide step, I was faiced to install problem:

    Collecting psycopg2==2.6 (from -r requirements.txt (line 5))
      Using cached psycopg2-2.6.tar.gz
        Complete output from command python setup.py egg_info:
        running egg_info
        creating pip-egg-info\psycopg2.egg-info
        writing pip-egg-info\psycopg2.egg-info\PKG-INFO
        writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt
        writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt
        writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
        warning: manifest_maker: standard file '-c' not found

        Error: pg_config executable not found.

        Please add the directory containing pg_config to the PATH
        or specify the full executable path with the option:

            python setup.py build_ext --pg-config /path/to/pg_config build ...

        or with the pg_config option in 'setup.cfg'.

        ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in c:\users\msimkin\appdata\local\temp\pip-build-hb6cgn\psycopg2

My local system:
OS: Win 8.1Pro
Hardware: DELL Latitude E7250

Default database engine is not Postgres

In the repo the default database engine is set to Sqlite3, while the tutorial uses Postgres:
https://github.com/heroku/python-getting-started/blob/master/gettingstarted/settings.py#L80
https://devcenter.heroku.com/articles/getting-started-with-python#provision-a-database

It would be helpful if the repo showed how to work with DATABASE_URL variable instead of hardcoding the database credentials from the app datastore credentials, which also requires looking up an example - we used https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-django-application-on-ubuntu-14-04

That would be very helpful for beginners. Thanks!

API app setup no longer works

curl -n -X POST https://api.heroku.com/app-setups \
-H "Content-Type:application/json" \
-H "Accept:application/vnd.heroku+json; version=3" \
-d '{"source_blob": { "url":"https://github.com/heroku/python-getting-started/tarball/master/"} }'

Please checkout PR #7 for reference.

same issue on PHP which was solve by same solution heroku/php-getting-started#8

error code H10

at=error code=H10 desc="App crashed" method=GET path="/" host

package

i have installed the package but still it shows not found package python
defect

DEFAULT_AUTO_FIELD warning when running `manage.py migrate`

Running heroku run python manage.py migrate on a new app created from this project gives the following warning:

System check identified some issues:

WARNINGS:
hello.Greeting: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

We should tweak the settings/migrations to suppress this on Django 3.2+.

The syncdb command will be removed in Django 1.9

$ python manage.py syncdb
env/lib/python2.7/site-packages/django/core/management/commands/syncdb.py:24: RemovedInDjango19Warning: The syncdb command will be removed in Django 1.9
  warnings.warn("The syncdb command will be removed in Django 1.9", RemovedInDjango19Warning)

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "env/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "env/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "env/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "env/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "env/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
    call_command("migrate", **options)
  File "env/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "env/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 93, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "env/lib/python2.7/site-packages/django/db/migrations/executor.py", line 19, in __init__
    self.loader = MigrationLoader(self.connection)
  File "env/lib/python2.7/site-packages/django/db/migrations/loader.py", line 47, in __init__
    self.build_graph()
  File "env/lib/python2.7/site-packages/django/db/migrations/loader.py", line 180, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "env/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "env/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()):
  File "env/lib/python2.7/site-packages/django/db/backends/base/base.py", line 162, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "env/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 21, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

.env file not used

It does not seem .env file to be used in this project. Maybe a reference to python-dotenv is missing with loading instructions at top of settings.py ?

Clone request link

Hi, I had issues cloning the file when using the syntax provided. I used git clone https://github.com/heroku/python-getting-started.git to download the repo

Application Error + GDAL_LIBRARY_PATH

Whenever I follow the Heroku get started instructions for Python I end up making an app that ultimately results in a page with "Application Error". Through researching the logs I have 3 instances of this error at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=desolate-eyrie-96916.herokuapp.com. After trying this heroku run python manage.py migrate command I get this error django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.. I even had my colleague try on his computer and he was receiving the same errors.

Python version is out of date

When deploying this app, the buildpack shows the message:

remote: -----> Python app detected
remote:  !     Python has released a security update! Please consider upgrading to python-3.7.6
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes

DEBUG=False for deployed application?

Project, once deployed, is still in debug mode (django debug) which does not fit to django deployed application guideline (DEBUG=False).

Maybe some settings.py adaptation is needed to load this DEBUG value from os.environ ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.